I have landed in a scenario were I have to let a user inside a database which is not his. Hence I want to make sure that he is only able to
SELECT from the views that I deem he can read from.
I have googled and tested, and it seems like I have found a solution, but I want to make sure that I'm right.
So below should give me UserA with full rights to DatabaseA, and only
SELECT permission to the 2 views in DatabaseB.
Is this correct, or am I opening up Pandora's box?
CREATE LOGIN UserA with password = 'UserA'
use DatabaseA GO create user UserA for login UserA GO EXEC sp_addrolemember N'db_owner', N'UserA' GO
use DatabaseB GO create user UserA for login UserA GO grant select on DatabaseB.dbo.v_ViewForUserA1 to UserA GO grant select on DatabaseB.dbo.v_ViewForUserA2 to UserA GO