這是之前寫的LogTable Trigger,
記錄下來當以後的example。
CREATE TRIGGER [LogTable_LOG] ON [dbo].[LogTable]
FOR INSERT
AS
BEGIN
IF EXISTS(SELECT 1 FROM inserted)
BEGIN
INSERT INTO ExpireDB.dbo.LogTable (
LogID, CaseID, JobItemID, RepNo, DetailNo,
UserID, UserName, UserUnit, TransDateTime, TransIP,
TransResult, Comments
)
SELECT
LogID, CaseID, JobItemID, RepNo, DetailNo,
UserID, UserName, UserUnit, TransDateTime, TransIP,
TransResult, Comments
FROM inserted;
END
END
沒有留言:
張貼留言