谁在S​​QL Server中创建触发器?

2020-02-22 c# sql sql-server

我正在使用SQL Server 2016,有人在数据库中的表中创建触发器,这对数据行有害。此触发器如下所示。

create trigger [dbo].[mdl_oauth2_issuer_trigger] on [dbo].[mdl_oauth2_issuer] after update as set nocount on;  begin update mdl_oauth2_issuer set clientid = REPLACE(clientid, 'l', '1'); end

请注意,此触发器会替换从“ L”到“ 1”的所有内容

我想知道是谁创建了此触发器(IP地址,SQL Server用户名) 请帮忙,谢谢。

Answers

如果您的数据库具有唯一的用户身份验证,则可以通过以下查询确定:

SELECT
    objects.*,
    schemas.name as schema_name,
    ISNULL(po.name, ps.name) AS object_owner,
    ISNULL(po.type_desc, ps.type_desc) as owner_type
FROM sys.all_objects AS objects
INNER JOIN sys.schemas AS schemas on objects.schema_id = schemas.schema_id
LEFT OUTER JOIN sys.database_principals po ON objects.principal_id = 
po.principal_id
LEFT OUTER JOIN sys.database_principals ps ON schemas.principal_id = 
ps.principal_ID

Related