Scenario: A development user has to be created. As a DBA, you create a SQL user, and pass on the login credentials (with permission restrictions) to the developer. After a few minutes, the developer complains that She cannot perform certain queries with the credentials you provided. While you can use ODBC to test connections and logins, there is another TSQL command that can be used: Execute As User. Example of the query:
EXECUTE AS USER=’user_name’
select * from sales table
Once the query is performed, the REVERT command will set you back to your old permissions. This is useful when you want to step into the developer’s shoes to see what is happening. You will need the impersonate permission (server or DB level) for the user that is using the ‘execute as’ command. This command replaces the SET USER statement in SQL 2000.