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

Setting permissions for SP with cross-database join 1

Status
Not open for further replies.

donutman

Programmer
Dec 20, 2002
2,481
US
I've granted exec permissions on a SP in database A. The SP references a table in db B. The connection string references db A. The connection fails because it doesn't have rights to the table in db B.
If I change the scenario so that the SP is defined in db B, but still use a connection string to db A, then the connection succeeds. Although I do have to tell the ADO control that the record source is B.dbo.SP. Maybe the reason that works is because the ADO control is smart enough to change the Initial Catalog to db B?
So the above works well, I do NOT have to give explicit table rights by using the SP approach. However, how do I solve the problem of doing a cross-database join within a SP without giving explicit Select rights to the table that is in a different db than the one used in the connection string?
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
This is called "cross-database ownership chaining" and can have security implications if not implemented carefully. For this reason it is disabled by default.

You can enable it for the whole server, or just for the specific databases involved which is the recommended method if you do need to use it.

Look it up in BOL for more info.

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top