日期:2014-05-18 浏览次数:20706 次
ALTER TRIGGER [dbo].[ResetAllure] ON [dbo].[a] AFTER INSERT,UPDATE AS BEGIN IF UPDATE(Available) Begin Update SM_AccountsList Set Allure=FLOOR((200*Available)/(50000+Available)+20-40*Rand()) where exists(select 1 from inserted where allure=SM_AccountsList) or exists(select 1 from deleted where allure=SM_AccountsList) Update SM_AccountsList Set Allure=1 from Where Allure <1 and (exists(select 1 from inserted where allure=SM_AccountsList) or exists(select 1 from deleted where allure=SM_AccountsList)) End 根据实际情况判断: update时有deleted,inserted insert时有inserted