Re: Select Permission Denied On Object
- From: "Dan Guzman" <guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 11 Oct 2006 19:12:38 -0500
What is the right way to set up permissions so that a user can
execute a stored procedure in one database that does a select on a
table in another database?
Permissions on indirectly referenced objects are not needed as long as the ownership chain is broken. For dbo-owned objects in different databases, this requires that both databases have the same owner so that the 'dbo' user maps to the same login. Also, the 'db chaining' database option (introduced in SP3) need to be turned on so that SQL Server will honor the cross-database ownership chain. For example (assuming your objects are owned by 'dbo'):
1) enable the 'db chaining' database option in both databases:
EXEC DB1.sp_dboption 'db chaining', true
EXEC DB2.sp_dboption 'db chaining', true
2) Make sure both databases have the same owner:
EXEC DB1..so_changedbowner 'SomeLogin'
EXEC DB2..so_changedbowner 'SomeLogin'
Be aware of the security implications before your enable cross-database chaining. Users with object create permissions can elevate their level of access to data in other databases. Enable 'db chaining' in an sa-owned database when only sysadmin role members can create dbo-owned objects. See the Books Online for more information.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"CSAWannabe" <wisertime2006@xxxxxxxxx> wrote in message news:1160604800.709446.16890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Guys,
I have a stored procedure in one database, that is doing a select
statement on a table in a different database on the same server.
I gave execute permission on the stored procedure to a particular
user. When that user executes the stored procedure they get the
following error:
'Select Permisssion Denied On Object: TableName' The TableName
is a table in the different database. If I grant 'select' permission
on the table in the different database to the user, then everything
works.. But I would rather not grant any permissions to the user on the
table, and limit the permissions to simply execute on a stored
procedure.
What is the right way to set up permissions so that a user can
execute a stored procedure in one database that does a select on a
table in another database?
I'm running MS SQL Server 2000 on Windows 2000.
.
- Follow-Ups:
- Re: Select Permission Denied On Object
- From: CSAWannabe
- Re: Select Permission Denied On Object
- References:
- Select Permission Denied On Object
- From: CSAWannabe
- Select Permission Denied On Object
- Prev by Date: Re: SQL Server Authentication
- Next by Date: RE: Roles based security 2005 versus 2000
- Previous by thread: Select Permission Denied On Object
- Next by thread: Re: Select Permission Denied On Object
- Index(es):
Relevant Pages
|