0
CREATE TRIGGER [dbo].[INSERT_IM_ServiceRequest_Hx] ON [dbo].[IM_ServiceRequest] AFTER INSERT
AS
BEGIN
INSERT INTO IM_ServiceRequest_Hx
SELECT * FROM INSERTED
PRINT 'AFTER INSERT Trigger fired.'
END
觸發2:
CREATE TRIGGER [dbo].[UPDATE_IM_ServiceRequest] ON [dbo].[IM_ServiceRequest] FOR UPDATE
AS
BEGIN
INSERT INTO IM_ServiceRequest_Hx
SELECT * FROM DELETED
PRINT 'FOR UPDATE Trigger fired.'
END
當然,這是從原來的觸發器細微的差別在0行的情況下'INSERT'或'UPDATE' 。原始觸發器仍然是'PRINT'消息,但這個觸發器不會。可能無所謂,但值得強調。 –
@Damien_The_Unbeliever我確實懷疑合併不會完全忠於OP的原始代碼,但不能指出它。你能幫我改進這個答案嗎?我真的很感激:) –