Reputation: 279
From this link, I noted that it is enough to grant application user 'execute' permission to the stored procedure.
But it will not work when the procedure is accessing the objects from different database.
We can think of two possible solutions, which involve creating a SQL login per database and assign minimum set of permissions, and
Is there any other solutions other better approaches than these?
Upvotes: 2
Views: 1779
Reputation: 294267
You are falling into the constrained execution model of 'execute as user'. This sand boxing is by design and has two possible solutions:
Read more:
Upvotes: 3
Reputation: 4472
Linked server is only needed if the query needs to access another server, however you don't need a linked server for accessing a separate database.
You can grant execute permissions like so:
USE [Database1]
GRANT CONNECT TO [username];
GRANT EXEC ON [schema].[sp_name] TO [username];
USE [Database2]
GRANT CONNECT TO [username];
GRANT EXEC ON [schema].[sp_name] TO [username];
Upvotes: 0