SQL server

Troubleshooting newly created users.

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.


Thinking about someting? Leave a Reply...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s