create trigger UpdateQueueTableInfo on his_queue after update as begin declare @sysDate datetime; declare @queueDate datetime; declare @appointsid varchar(50); declare @flag int; declare @oldflag int; select @sysDate=GETDATE() from deleted select @queueDate=APPOINTSDATE,@appointsid=APPOINTSID,@flag=FLAG from deleted select @oldflag=FLAG from inserted; --print ‘更新前flag‘ --print ‘更新后flag‘ --提前转登记 if(@sysDate<@queueDate and (@flag=2 or @flag=3) and @oldflag<>@flag) update QUEUEDETAIL set ISPREREGISTER=‘1‘ where [email protected]; update HIS_QUEUE set ISPREREGISTER=‘1‘ where [email protected]; --else if(@sysDate>[email protected]) end --ALTER TABLE [myschema].[TAB_USR] ENABLE TRIGGER UpdateQueueTableInfo
原文地址:https://www.cnblogs.com/YYkun/p/11417395.html
时间: 2024-11-22 21:35:27