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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function owner name in MSSQL 2000

Status
Not open for further replies.

krist

Programmer
May 30, 2001
114
ID
Hi guys,
I want to create a Function in MSSQL 2000, e.g : CDATE.
It is annoying that everytime I want to use that function, I must mention owner name of that function (e.g:dbo).

example :
SELECT * FROM XYZ WHERE ORDERDATE = dbo.CDATE("xyz")

otherwise, that function IS NOT recognized.

I Don't want to mention 'dbo.' every time I use that function, how to do that ?

Thanks in advance,
Krist
 
You must prefix the function with the database owner prefix. SQL BOL explains.[ul]Calling User-Defined Functions
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()[/ul] Terry

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Although, it would really be a great feature to have.

Like stored procedures, we must be able to call the functions without prefixing with Owner names. Thank you,
RR.
__________________________________
The best is yet to come.
 
Let Microsoft know what you want. Send ideas and requests to the SQL Wish List at...

sqlwish@microsoft.com
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top