SQL Server 2008-触发器是否以与登录名/用户相同的权限运行? [英] SQL Server 2008 - Does a trigger run with the same permissions as the login/user?
问题描述
一个简单的问题:
说我在数据库中的表上放置了一个插入触发器。
如果通过登录名/用户 foobar将数据插入到该表中。
触发器是否以与 foobar相同的访问权限执行? p>
非常感谢。
是。
您可以使用
执行AS
$ c $来控制此行为c>
create语句的条款,如解释。
触发器的默认设置为
作为调用程序执行$ b $ b
在哪里找到
CALLER
指定模块内的语句在
调用程序的上下文中执行模块的执行模块
的用户不仅必须对模块本身具有适当的权限,而且还必须对模块所引用的任何数据库对象具有
的权限。
CALLER是除队列之外的所有模块的默认值,与SQL Server 2005的行为相同。
Just a quick question:
Say I put an insert trigger on a table in my database.
If data is inserted into that table through a login/user "foobar".
Does the trigger execute with the same access rights / permissions as "foobar"?
Many thanks.
Yes.
You can control this behaviour with the
EXECUTE AS
clause of the create statement, as explained here.
The default for triggers is
EXECUTE AS CALLER
where we find
CALLER
Specifies the statements inside the module are executed in the context of the caller of the module. The user executing the module must have appropriate permissions not only on the module itself, but also on any database objects that are referenced by the module. CALLER is the default for all modules except queues, and is the same as SQL Server 2005 behavior.
这篇关于SQL Server 2008-触发器是否以与登录名/用户相同的权限运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!