Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 calling user function without dbo.

Author  Topic 

nice123ej
Starting Member

48 Posts

Posted - 2008-06-23 : 21:28:02
Hi
I have created a user function
the only way i can use this function is by specifying dbo. as prefix of the function

example

SELECT column1, dbo.MyFunc(column2)
FROM mytable


what i want is something like this

SELECT column1, MyFunc(column2)
FROM mytable


is this possible?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-23 : 21:28:59
No, you must specify the object owner when calling functions. See BOL for details.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-24 : 00:01:57
quote:
Originally posted by nice123ej

Hi
I have created a user function
the only way i can use this function is by specifying dbo. as prefix of the function

example

SELECT column1, dbo.MyFunc(column2)
FROM mytable


what i want is something like this

SELECT column1, MyFunc(column2)
FROM mytable


is this possible?


Any reason why you dont explicitly want to specify owner?
Go to Top of Page

nice123ej
Starting Member

48 Posts

Posted - 2008-06-30 : 20:44:52
I dont use dbo. when i execute Stored Procs or select from table,
why i need it for Functions only?!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-06-30 : 22:35:26
this is what the BOL says about invoking the UDF.

http://msdn.microsoft.com/en-us/library/ms175562.aspx
quote:
Scalar-valued functions must be invoked by using at least the two-part name of the function


Why ? Ask the designer


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -