以另一个用户权限执行存储过程 [英] Execute a stored procedure as another user permission

查看:99
本文介绍了以另一个用户权限执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下问题:有一个用户必须执行存储过程(spTest).在spTest的主体中,调用了sp_trace_generateevent. sp_trace_generateevent需要更改跟踪权限,我不希望用户拥有它.因此,我希望用户能够执行spTest.我怎样才能做到这一点?

I faced the following problem: there's a user who has to execute a stored procedure (spTest). In spTest's body sp_trace_generateevent is called. sp_trace_generateevent requires alter trace permissions, and I don't want user to have it. So I would like user to be able to execute spTest. How can I do that?

推荐答案

尝试一下:

EXECUTE AS user = 'special_user'

EXECUTE YourProcerdure

REVERT

请参阅以下内容:
了解上下文切换 <<<has examples of things like you are trying to do
了解执行上下文
执行AS子句(Transact-SQL)
执行AS(Transact-SQL)

see these:
Understanding Context Switching <<<has examples of things like you are trying to do
Understanding Execution Context
EXECUTE AS Clause (Transact-SQL)
EXECUTE AS (Transact-SQL)

这篇关于以另一个用户权限执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆