[SQL] 纯文本查看 复制代码
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: <Author,sufei>
-- Create date: <Create Date,2010-05-11>
-- Description: <当是短信充值时修改相信的记录使记录不会重复获取>
-- =============================================
ALTER TRIGGER [dbo].[updatestart]
ON [dbo].[OrderTelecom] FOR update
AS
BEGIN
DECLARE @state int;
DECLARE @note2 varchar(50)
SELECT @state= Inserted.ortState,@note2 =Inserted.ortNote2 from Inserted
IF @state=1 AND @note2=1
begin
--当发短信猫取走记录时修改状态为成功和取过的状态
update OrderTelecom set OrderTelecom.ortState=2 ,OrderTelecom.ortSmsmessages='短信充值成功'
from OrderTelecom inner join Inserted on OrderTelecom.ortId=Inserted.ortId
end
if @state in(2,3,10) and @note2=0
begin
update OrderTelecom set ortNote2=1
from OrderTelecom inner join Inserted on OrderTelecom.ortId=Inserted.ortId
end
END