CREATE TRIGGER [dbo].[timecard_documentstatus_update]
ON [dbo].[hrm_timecard]
FOR UPDATE
AS
IF UPDATE(documentstatus)
BEGIN
INSERT INTO hrm_timecard_approval
(id,
actiondate,
olddocumentstatus,
newdocumentstatus,
action)
SELECT I.id,
Getdate(),
D.documentstatus,
I.documentstatus,
'UpdateDocumentStatus'
FROM inserted I
INNER JOIN deleted D
ON I.id = D.id
WHERE I.id = D.id
END
go
No comments:
Post a Comment