I have created a login in SQL Server 2008 R2 and given access to run stored procedures in that database only. But this stored procedure is actually accessing data from other two databases to which this user doesn't have access and I cannot give access to those databases.
How can I create such a user with single database access but can run query on other two database through this stored procedure only?
So far what I have done:
Created login and mapped to
Database1
Right click on the stored procedure in
Database1
and given permission to this user to execute this stored procedureThis stored procedure is running a query to get data from two other databases (
Database2
andDatabase3
)e.g.
Select value1, value2, value3 from Database1.[dbo].table1 inner join Database2.[dbo].table2 on .... inner join Database3.[dbo].table3 on ....