Re: Impersonation with SQL Server 2005



Marcus,

Here is a good rundown of the options, with implementation details, by
Erland Sommarskog.
http://www.sommarskog.se/grantperm.html

RLF

"Marcus Müller" <marcusmueller@xxxxxx> wrote in message
news:60566F1B-6B85-4A52-8C86-89580E579326@xxxxxxxxxxxxxxxx
How can I impersonate a SQL server user in a stored procedure and run a
query under a different windows user account ?

The background is that I got an ASP application which uses a common user
(e.g. "my_user") to access the SQL server. This works fine. However, I
have to access an Active Directory via ADSI which does not know anything
about the SQL user and the LDAP queries fail because of insufficient
rights. Thus, I have to impersonate in a stored procedure and use a
different user from the AD to run the ADSI queries.

I have tried to map the SQL user 'my_user' to an existing AD user in the
security tab of the linked server but this yields only a error message
that the current security context not trustable.

Many thanks in advance,

Marcus


.