SQL Server 2008 - 触发器是否以与登录名/用户相同的权限运行? [英] SQL Server 2008 - Does a trigger run with the same permissions as the login/user?

查看:59
本文介绍了SQL Server 2008 - 触发器是否以与登录名/用户相同的权限运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是一个简单的问题:

假设我在数据库中的一个表上放置了一个插入触发器.

如果数据是通过登录名/用户foobar"插入到该表中的.

触发器是否以与foobar"相同的访问权限/权限执行?

非常感谢.

解决方案

是.

您可以使用

控制此行为

EXECUTE AS

create 语句的子句,如在此处解释.>

触发器的默认值是

作为调用者执行

我们在哪里找到

<块引用>

来电者

指定模块内部的语句在上下文中执行模块的调用者.执行模块的用户不仅必须对模块本身具有适当的权限,而且也适用于模块引用的任何数据库对象.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屋!

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