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 2000 Forums
 SQL Server Development (2000)
 difference between dbo.function and function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-09-14 : 06:44:45
bollu writes "the detailed question is when ever we create a function we give
function name like create function babu like this way.
but we can retrieve the function we can call
" select dbo.function name " why this willbe happening
please reply me

thanks"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-14 : 07:28:51
Refer dbo in Books On Line

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-14 : 08:00:22
Hi bollu, Welcome to SQL Team!

Its better to always specify the "owner". Otherwise the user ID you are connected to the database with may be used as the owner [instead of "dbo"].

Also, explicitly specifying the owner means that SQL Server doesn't have to check whether there is an object for your logon-ID first, and then fall back to looking for the default "dbo" one. That saves time, and also means that SQL Server can cache the query - which it might not otherwise be able to do.

Kristen
Go to Top of Page

magesh
Starting Member

23 Posts

Posted - 2005-09-15 : 01:30:29
Hi,

i too intended to ask the same question in this forum.
the question is,

for UDF we have to specify the owner name compulsory
for SP it is not compulsory.

can any one tell me y this diff.

Magesh
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-15 : 06:51:26
from BOL

quote:

Function Invocation
Scalar-valued functions may be invoked where scalar expressions are used, including computed columns and CHECK constraint definitions. When invoking scalar-valued functions, at minimum use the two-part name of the function.

[database_name.]owner_name.function_name ([argument_expr][,...])

If a user-defined function is used to define a computed column, the function's deterministic quality also defines whether an index may be created on that computed column. An index can be created on a computed column that uses a function only if the function is deterministic. A function is deterministic if it always returns the same value, given the same input.

Table-valued functions can be invoked using a single part name.

[database_name.][owner_name.]function_name ([argument_expr][,...])

System table functions that are included in Microsoft® SQL Server™ 2000 need to be invoked using a '::' prefix before the function name.

SELECT *
FROM ::fn_helpcollations()

Transact-SQL errors that cause a statement to be stopped and then continued with the next statement in a stored procedure are treated differently inside a function. In functions, such errors will cause the function execution to be stopped. This in turn will cause the statement that invoked the function to be stopped.




HTH

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -