From: Bassam on
Hello,

we are using SQL Server 2005 , I have the admin role and know SA Password ,
once in a while I receive calls from users in the network complain about
some error , some times error is not clear and I have to login using user's
password instead of SA to see what's happening , to do that I have to reset
user's password then do the test and fix then tell the user that his
password has been reset and he has to set it again

is there anyway , because I'm admin , I can impersonate users login ,
meaning login using user's name even so I don�t know his password ?

Thank you
Bassam


From: Erland Sommarskog on
Bassam (egbas(a)yahoo.com) writes:
> we are using SQL Server 2005 , I have the admin role and know SA
> Password , once in a while I receive calls from users in the network
> complain about some error , some times error is not clear and I have to
> login using user's password instead of SA to see what's happening , to
> do that I have to reset user's password then do the test and fix then
> tell the user that his password has been reset and he has to set it
> again
>
> is there anyway , because I'm admin , I can impersonate users login ,
> meaning login using user's name even so I don't know his password ?

Yes.

EXECUTE AS LOGIN = 'someuser'
go
-- Do stuff.
go
REVERT


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx