急 sqlserver2005 触发器报错!
触发器已编译成功
代码如下:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER [wfi_proc_msg_trigger]
ON [dbo].[WFI_PROC]
AFTER insert
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
insert into [phs_mess].[sms].[dbo].[MSGTASK](TASKNAME,MANAGER ,SOURCE ,GATENAME,SMID,PRIORITY,CODE,MAXNUM,DAYMAXNUM,INFO,INFOFLAG,DOTIME,FLAG ,SENDNUM ,STARTTIME,ENDTIME,NEXTTIME ,DBPROC)
SELECT
( 'msg '+cast(inserted.procid as VARCHAR(100))) ,
'19341 ',
cast(SUBSTRING(TB_USERS.MbTel, 1, 8) as TEXT) ,
' ',
' ',
1,
15,
1,
1,
WFI_TASK.TaskName,
' ',
getdate(),
1,
0,
getdate(),
dateadd(day,1,getdate()),
10,
' '
FROM inserted INNER JOIN
TB_USERS ON inserted.UserID = TB_USERS.UserID INNER JOIN
WFI_TASK ON inserted.TaskID = WFI_TASK.TaskID
WHERE (WFI_TASK.Enable = 1)
AND (WFI_TASK.Result LIKE N '处理中 ')
AND (inserted.Finished = 0)
AND (inserted.opened=0)
AND (TB_USERS.UserID in (182,2506,1454,1453,2882,3039))
insert into [phs_mess].[sms].[dbo].[MSGTASKTIME](TASKNAME,STIME,ETIME,INTIME, FLAG)
select ( 'msg '+cast(inserted.procid as VARCHAR(100))) as procid, '00:00:01 ', '23:59:59 ',getdate(),2
FROM inserted INNER JOIN
TB_USERS ON inserted.UserID = TB_USERS.UserID INNER JOIN
WFI_TASK ON inserted.TaskID = WFI_TASK.TaskID
WHERE (WFI_TASK.Enable = 1)
AND (WFI_TASK.Result LIKE N '处理中 ')
AND (inserted.Finished = 0)
AND (inserted.opened=0)
AND (TB_USERS.UserID in (182,2506,1454,1453,2882,3039))
END
--[phs_mess] 是连接服务器 就是另一个远程数据库
每当我向wfi_proc插入数据 &n