Sunday, December 12, 2010

Impersonation (SQL)

You may be familiar with the ‘Run as..’ option in Windows.
In SQL, you can impersonate another principal to execute commands in a specific user context.
You must have the IMPERSONATE permission grated to your account on the principal that you want to impersonate. You can also assign the IMPERSONATE permission during login, so you can execute under that principal`s authority in any database to which the principal has access.

EXEC | EXECUTE AS <context_spcification>

No comments: