Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL 2000 User Defined Functions 1

Status
Not open for further replies.

NickCorlett

Technical User
May 23, 2002
71
GB
I have created a user defined function called "ufnNTUser".

When I attempt to call this function from within another stored procedure it insists I place the "dbo." in front of the function name.

Is there anyway I can get rid of the need for the "dbo." in front?
 
I believe that if the stored procedure is also owned by dbo then you won't have the problem. If you create the stored procedure as any other user, then you will have to use "dbo." to let the stored procedure know that you are using another's user defined function. -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
I have checked this out, the stored procedure using this function is owned by dbo also I have tried creating further functions logged on as other users and they are all given the owner of dbo?

Any further thoughts.
 
It has always been my experience that you have to place the dbo. in front of the function when used in a select statement, but not when used as a table in the from clause.
 
SQL BOL states the following.

When calling a scalar user-defined function, you must supply at least a two-part name:

SELECT *, MyUser.MyScalarFunction()
FROM MyTable

Table-valued functions can be called by using a one-part name:

SELECT *
FROM MyTableFunction()

However, when you call SQL Server built-in functions that return a table, you must add the prefix :: to the name of the function:

SELECT * FROM ::fn_helpcollations()
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains &quot;Suggestions for Getting Quick and Appropriate Answers&quot; to your questions.
 
As ususal, tlbroadbent has the full and correct answer... Thanks! You get yet another star.... -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top