Friday, February 24, 2012

how to get impersonate permission?

Say i have two login accounts in sql server 2005,I want to do context switch operation for two accounts.

I want to know to get impersonate permission....

any suggestions?

thanks

Try to use EXECUTE AS T-SQL command , see

|||

hi ggciubuc

I know I should use "execute as" command to implement impersonation.

But the command caller must have impersonate permissions... i want to know how to get the permission

thanks

|||

You can use the IMPERSONATE permission, it should be described in BOL (http://msdn2.microsoft.com/en-us/library/ms178569.aspx), but from a quick look to it, it seems like it may not be clear enough.

Here is a short description on how to use them.

For user impersonation, you need to connect to the appropriate DB and grant IMPERSONATE permission to the user using the following syntax:

GRANT IMPERSONATE ON USER::<<impersonated_context_user_name>>

TO <<grantee_user_name>>

for example:

GRANT IMPERSONATE ON USER::[user_to_be_impersonated] TO [user1]

go

For login impersonation, you need to connect to master DB and then grant the IMPERSONATE permission to the login:

GRANT IMPERSONATE ON LOGIN::<<impersonated_context_login_name>>

TO <<grantee_login_name>>

for example:

GRANT IMPERSONATE ON LOGIN::[login_to_be_impersonated] TO [login1]

go

I hope this information helps, and please let us know if you have any further question on this topic. We will be glad to help. We really appreciate your feedback on BOL; it will help us to improve our documentation and the general quality of SQL Server.

Thanks,

-Raul Garcia

SDE/T

SQL Server Engine

No comments:

Post a Comment