SELECT *
FROM deleted
CREATE TRIGGER TR_LKCRM_SQJBXXINS
ON dbo.LKCRM_SQSP_SQJBXX
FOR INSERT
AS
BEGIN
DECLARE CUR_LKCRM_SQJBXXINS CURSOR FOR SELECT INS.SQXH,INS.DYXH,INS.SQLB FROM INSERTED INS
DECLARE @SQXH INT
DECLARE @DYXH INT
DECLARE @SQLB NVARCHAR(2)
OPEN CUR_LKCRM_SQJBXXINS
FETCH NEXT FROM CUR_LKCRM_SQJBXXINS INTO @SQXH,@DYXH,@SQLB
WHILE @@FETCH_STATUS = 0
BEGIN
IF @SQLB='01' OR @SQLB='04'
UPDATE LKCRM_DD_DDXX SET SPTGBZ='0' WHERE DDXH=@DYXH
ELSE
BEGIN
IF @SQLB='02'
UPDATE LKCRM_DD_THDXX SET SPTGBZ='0' WHERE THDXH=@DYXH
ELSE
BEGIN
IF @SQLB='03'
UPDATE LKCRM_SC_SCHDJL SET SPTGBZ='0' WHERE HDXH=@DYXH
END
END
FETCH NEXT FROM CUR_LKCRM_SQJBXXINS INTO @SQXH,@DYXH,@SQLB
END
CLOSE CUR_LKCRM_SQJBXXINS DEALLOCATE CUR_LKCRM_SQJBXXINS
END
本文地址:http://com.8s8s.com/it/it20295.htm