SQL Server
(1)
User defined function
(1)
Stored procedure
(1)
Module
(1)
Bit
(1)
ADPbut
(1)
Windows
(1)
Futureendeavors
(1)

HOW do I ' create function ' ???? ' cannot change object type in a script ' ????

Asked By Bob
18-Nov-09 08:52 PM
this is about as newbie as it gets, and I cannot seem to find an answer
in any source!!!!

all I want to do is create a user defined function.
I am running access 2k project as the front end, and sql-server (7) as
back end.

WHERE exactly do I go to create an user defined function??!??

if I try to create a new procedure, and say 'create function '  - I
get ' cannot change object type '.

so if I do not create a function in the 'stored procedures' area of an
adp - WHERE EXACTLY do I go to do this????

if this cannot be done w/ sql 7 - using this syntax - how do I create a
user defined table or function in sql 7.... or more specifically - how
do I reference a function from a view that will work.
(defining a function as a module - apparently can NOT be used in a
view)

TIA -
Bob

First, why all these ??!?? and these UPPERCASES everywhere in your post?

Sylvain Lafontaine replied to Bob
18-Nov-09 06:27 PM
First, why all these ??!?? and these UPPERCASES everywhere in your post?

Second, you cannot create an User Defined Function (UDF) on SQL-Server 7;
this require at least the version 2000. Also, it is a bad idea to use Access
2000 to create an ADP project as this version is full of bug.  I would
suggest to use the 2003 version, if possible; otherwise, the 2007 version
but fully patched.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)

More info about UDF in the following article:http://www.15seconds.

Sylvain Lafontaine replied to Sylvain Lafontaine
18-Nov-09 06:35 PM
More info about UDF in the following article:
http://www.15seconds.com/Issue/000817.htm .

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)

Sylvain-TYVM for your reply; apologies for my improper (excessive) use of

Bob replied to Sylvain Lafontaine
18-Nov-09 08:52 PM
Sylvain-

TYVM for your reply; apologies for my improper (excessive) use of caps
& punct.

I hear what you are saying.... but I am in a situation, that due to
numerous reasons, will not change.

So within the context of sql 7, and access 2k....

is there isome other way to provide the functionality of having a user
defined function that can be referenced in a view?

TX again IA...
Ooooo... excellent reference.... at least for futureendeavors :)..... TY
Bob replied to Sylvain Lafontaine
18-Nov-09 08:52 PM
Ooooo... excellent reference.... at least for future
endeavors :).....  TY
For your first question, SQL-7 is not really a problem for working with ADPbut
Sylvain Lafontaine replied to Bob
18-Nov-09 07:38 PM
For your first question, SQL-7 is not really a problem for working with ADP
but ADP 2000 might be instead of 2003 or 2007 might be for some loss of
functionality here and there.

For your second question, without knowing what you want to do with this
function and in under which context, it is hard to suggest you any
alternative.

If you want to retrieve the result in ADP, the best way would be to use a
stored procedure.  If you wanted to use it inside a View, then you could use
another View but then, you cannot have a parameterized View or a
Multi-statement View; so this limit your possibilities.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)
actually - what I really want to do is quite simple in concept...
Bob replied to Sylvain Lafontaine
19-Nov-09 07:18 PM
actually - what I really want to do is quite simple in concept...

I have a complicated math formula which I will represent simply as y=mx
+b.
I have a public function setup in my adp's module section that works
perfectly.
in this example, m & b are constants that are read from a table; x is
the input to the function, and obviously, y would be the output.

I want to create a view that would be able to have a column that uses
this function.
SQL-Server should be used for storing and retrieving data, not for
Sylvain Lafontaine replied to Bob
19-Nov-09 04:19 PM
SQL-Server should be used for storing and retrieving data, not for doing
computation.  If you have already set up a function an in ADP module that
give you the result, then you should do this computation in the ADP
application itself and use SQL only for retrieving the data.

I will do some tests later and I come back again on this question in a few
hours.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)
Sylvain - TYVM for any additional light you can shed on the subject...
Bob replied to Sylvain Lafontaine
19-Nov-09 07:18 PM
Sylvain - TYVM for any additional light you can shed on the subject...

I agree in principle with what you are saying.... except that a view
really is not stored in the adp - it is on sql server.
and there are no "queries" in an adp (which could reference/access the
adp's modules). So this presents a bit of a quandry [sp?]....
marielly replied to Bob
09-Feb-10 08:21 PM

         
Post Question To EggHeadCafe