November 4, 2010 at 7:52 am
How can I run TSQL script as another user in SSMS to simulate that user's result and view the effect of their permissions?
November 4, 2010 at 7:59 am
Check out the EXECUTE AS command in Books On Line. Here is a sample from BOL.
CREATE PROCEDURE dbo.usp_Demo
WITH EXECUTE AS 'SqlUser1'
AS
SELECT user_name(); -- Shows execution context is set to SqlUser1.
EXECUTE AS CALLER;
SELECT user_name(); -- Shows execution context is set to SqlUser2, the caller of the module.
REVERT;
SELECT user_name(); -- Shows execution context is set to SqlUser1.
GO
November 4, 2010 at 8:44 am
Thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply