I have two databases on the same SQL Server:
Database A
Database B
I want to give user1 access to the database, but only through the EXECUTE permission on the sprocs.
I do not want to grant select permission, because this breaks the security model of "only access the database through sprocs"
You may need to enable cross database ownership chaining for both databases.
To see if it's enabled:
select name, is_db_chaining_on
from sys.databases
To enable the setting:
EXEC sp_dboption 'DatabaseA', 'db_chaining', 'true';
GO
EXEC sp_dboption 'DatabaseB', 'db_chaining', 'true';
GO
I had exactly this problem but in my case the solution was to update the two databases to have the same owner.
If the databases are owned by the same owner you don't need to explicitly turn on ownership chaining (as the owners are one and the same).
Great article on this here: [http://www.sommarskog.se/grantperm.html][1]
You can update the ownership of a database using sp_changedbowner or the "ALTER AUTHORIZATION" statement for more recent version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With