dbTalk Databases Forums  

User Function Syntax

microsoft.public.sqlserver.mseq microsoft.public.sqlserver.mseq


Discuss User Function Syntax in the microsoft.public.sqlserver.mseq forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
KLomax
 
Posts: n/a

Default User Function Syntax - 02-06-2004 , 11:40 AM






In the statement below, the function name need's to be
prefixed with "dbo." to work. Is there anyway to make a
User Function visible without specifying the user? Meaning
is there a way to make "SELECT Answer = fnPlusOne(2)" a
valid statement?

CREATE FUNCTION fnPlusOne( @Value int )
RETURNS int
AS
BEGIN RETURN @Value + 1 END
SELECT Answer = dbo.fnPlusOne(2)

Thank you in advance.
KLomax

Reply With Quote
  #2  
Old   
Vishal Parkar
 
Posts: n/a

Default Re: User Function Syntax - 02-06-2004 , 11:51 AM






hi klomax,

When invoking scalar user defined function you will have to use minimum two-part
name of the function ie "owner" and "function name"
Ex
select owner_name.function_name (parm1,para.2....)

Whereas Table-valued functions can be invoked using a single part name.
Ex:
select * from function_name (parm1,para.2....)


--
Vishal



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.