questions on user-defined function 
Author Message
 questions on user-defined function
Hi, all,

I am curious if I can:

1. Name a user-defined function without any prefixes
   i.e.  func1(..) instead of obj.user.func1(..)

2. How to use update within a user-defined function.
   insert and select work fine, but somehow I can not
   make it work for update.

I just starting using MS SQL server 2000, and I apologize if this
question has been answered previously, sorry :-)

Regards,
Jae



Mon, 10 Nov 2003 14:55:50 GMT
 questions on user-defined function

Jae,

From Booksonline: " User-defined functions cannot be used to perform a set
of actions that modify the global database state. " .  As far as I know you
have to specify at least the owner and function ( dbo.function() ).  My
advise on functions is to use them when it makes sense either to keep the
code cleaner or when you just can't use a stored procedure or cursor.  Don't
automatically try and do everything in UDF's. For standard sql a stored
procedure will generally be faster.

--
Andrew J. Kelly
Targitmail


Quote:
> Hi, all,

> I am curious if I can:

> 1. Name a user-defined function without any prefixes
>    i.e.  func1(..) instead of obj.user.func1(..)

> 2. How to use update within a user-defined function.
>    insert and select work fine, but somehow I can not
>    make it work for update.

> I just starting using MS SQL server 2000, and I apologize if this
> question has been answered previously, sorry :-)

> Regards,
> Jae



Mon, 10 Nov 2003 20:00:33 GMT
 questions on user-defined function
UDFs must be called with the 2 part name dbo.myfunc..

UDFs may NOT do insert update or delete to anything other than an internal
table in a UDF.. They are not allowed to make changes to the database...

--
Wayne Snyder SQL Server MVP
IKON Education Services, C{*filter*}te, NC
(Please Respond to newsgroups)



Mon, 10 Nov 2003 20:14:41 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. call a user defined function from another user-defined function

2. Question on user defined function (SQL Server 2000)

3. user-defined function client server question

4. user defined function question

5. Newbie questions on User-defined functions in SQL server

6. Question about user-defined functions

7. User Defined Function Question

8. A user defined function question

9. User defined function question

10. Question on User-Defined Functions

11. Question on user defined function (SQL Server 2000)

12. more question about adding values from user defined function


 
Powered by phpBB® Forum Software