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 Administration (2000)
 Problem in executing fuctions without owner name

Author  Topic 

vijkr77
Starting Member

2 Posts

Posted - 2002-02-21 : 07:19:42
Hi,

I have a problem in executing a function or a stored procedure without the owner name, who created it.

If I need to execute a function or a stored procedure created by other users, either of the following has to be done.

1. The function or a stored procedure to be referred by the user who created it. Example, 'username.function' OR,

2. Change the owner of the object to 'dbo' and grant execute permission.

I request someone to help me on this. Thanks.

Vijay.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-21 : 07:24:54
There's been some debate recently that recommends ALL objects in a database be created under dbo. That would be your best bet.

Use the sp_changeobjectowner system procedure to change the name of an object (this is documented in Books Online with the syntax). If you can't change an object with this, drop the existing object and re-create it as dbo.

Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2002-02-21 : 11:43:10
This is the way SQL Server attempts to find objects (Functions, SPs etc..) that don't specifically reference the owner.

It first looks for the referenced object owned by the calling user. If it doesn't find that, it looks for the referenced object owned by dbo. If it doesn't find that it errors out.

So, you should always use the full notation when calling your SPs or Funcs (Db.Owner.Object) or do as Rob says and make them owned by dbo.

-Chad

Go to Top of Page

vijkr77
Starting Member

2 Posts

Posted - 2002-02-22 : 00:40:51
Thanks Rod & Chad.

Go to Top of Page
   

- Advertisement -