我创建了一个简单的删除触发器,该触发器被触发但 0 行受到影响。父表记录已删除。但是表中的记录也应该删除而不是删除。我有以下查询。
ALTER trigger [dbo].[studentAuditActionDelete] on [dbo].[tblStudent]
after delete
AS
declare @studentId_Audit int;
select @studentId_Audit = i.studentID from inserted i;
delete from studentAudit
where
studentId_Audit = @studentId_Audit
PRINT 'AFTER Delete trigger fired.'