ALTER trigger [update_Tts_Hotel_Master] on [dbo].[Tts_Hotel_Name] after update --insert, update, delete as --列级触发器:是否更新了酒店名称 if (update(H_Name)) begin update Tts_Hotel_Master set Tts_Hotel_Master.Hm_hName =inserted.H_Name from Tts_Hotel_Master,inserted where Tts_Hotel_Master.Hm_Hid=Inserted.H_ID end
ALTER trigger [Modify_Tts_OrderRemark] on [dbo].[Tts_Order_Log] FOR INSERT, UPDATE AS declare @row int select @row=@@rowcount if @row=0 return if(exists(select 1 from inserted)) begin update h1 set Tts_OrderRemark = isnull(h1.Tts_OrderRemark,'') + convert(varchar(16),getdate(),120)+'|'+cast(h2.Tts_UserName as nvarchar(20))+'|'+cast(h2.Tts_OrderRemark as nvarchar(300))+'☆' from Tts_Order_Total as h1,inserted as h2 where h1.Tts_OrderID=h2.Tts_OrderID end