//复制优惠券表解钩 Use HSHDBNew SELECT * INTO TempExistCoupon FROM DiscountActivityPager WHERE 1=2
--update触发器 Create TRIGGER tri_update ON DiscountActivityPager AFTER update as begin if update(UDSateID) and (select top 1 UDSateID from DiscountActivityPager WHERE UDID=(select top 1 UDID from Deleted))=‘2‘ INSERT INTO [TempExistCoupon] (UDID,UserID,BID,DID,UDNO,UDCode,UDDateTime,Memorandum,DiscontDetail,BusName,UDSateID,CheckDate,CheckIntegralCount,Ratings,StarLevel,CheckContentStr,BEID,UserCount,BatNo) SELECT [UDID],[UserID],[BID],[DID],[UDNO],[UDCode],[UDDateTime],[Memorandum],[DiscontDetail],[BusName],[UDSateID],[CheckDate],[CheckIntegralCount],[Ratings],[StarLevel],[CheckContentStr],[BEID],[UserCount],[BatNo] FROM DiscountActivityPager where UDID=(select top 1 UDID from Deleted) end
原文地址:http://www.cnblogs.com/lykbk/p/3862436.html