开发者

SQL-Server: Impersonation

is there any way to make a certain session execute all commands as a开发者_StackOverflow社区 certain user? I cannot use the execute as clause because it mustn't be hardcoded.

I need something along the lines of this pseudocode:

ALTER SESSION sessionid SET EXECUTING_USER=someuser


EXECUTE AS can accept variables (in 2008 at least) so you don't have to hardcode the name to use it.

DECLARE @username sysname = 'foobar'

EXECUTE AS USER = @username

SELECT SESSION_USER

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜