我怎样才能获得“外部名称”? SQL CLR 触发器?
我使用以下 SQL 创建了一个 SQL CLR 触发器:
GO
CREATE TRIGGER AuditAccountsTable
ON [dbo].[Accounts]
FOR INSERT,DELETE,UPDATE
AS
EXTERNAL NAME namespace.Triggers.AuditTrigger
我正在尝试查询:
select * from sys.triggers
有没有办法通过在数据库中查询来找到触发器上的 EXTERNAL NAME namespace.Triggers.AuditTrigger
?
I have created a SQL CLR trigger with the follow SQL:
GO
CREATE TRIGGER AuditAccountsTable
ON [dbo].[Accounts]
FOR INSERT,DELETE,UPDATE
AS
EXTERNAL NAME namespace.Triggers.AuditTrigger
I am trying to query:
select * from sys.triggers
Is there a way to find the: EXTERNAL NAME namespace.Triggers.AuditTrigger
on the trigger from querying in the DB?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不能确定,因为我没有地方可以测试这个,但是下面返回的文本列是否能让您接近您正在寻找的内容?
I can't be sure as I don't have a place to test this, but does the text column returned below get you close to what you're looking for?
与存储过程和函数等 T-SQL“模块”不同,SQLCLR T-SQL 包装对象的
CREATE
语句不存储在数据库中。这就是为什么您无法通过 sys.sql_modules 访问它们,OBJECT_DEFINITION,或已弃用的-SQL-Server-2005-and-should-不使用 sys.syscomments。这就是为什么 SQLCLR 存储过程和函数需要将其参数默认值存储在 sys 中。参数相反,SQLCLR T-SQL 包装对象的 CREATE 语句是从元数据推断出来的,就像索引、主键、外键等一样。
您可以获取以下内容的所有部分:来自以下查询的
CREATE TRIGGER
语句:Unlike T-SQL "modules" such as Stored Procedures and Functions, the SQLCLR T-SQL wrapper objects do not have their
CREATE
statements stored in the database. This is why you cannot access them via sys.sql_modules, OBJECT_DEFINITION, or the deprecated-since-SQL-Server-2005-and-should-not-be-used sys.syscomments. This is why SQLCLR Stored Procedures and Functions need to have their parameter default values stored in sys.parametersInstead,
CREATE
statements for SQLCLR T-SQL wrapper objects are inferred from meta-data, just like Indexes, Primary Keys, Foreign Keys, etc.You can get all of the parts of the
CREATE TRIGGER
statement from the following query: