代码
CREATE TRIGGER [dbo].[Up_T]
ON [dbo].[T1]
FOR UPDATE
AS
begin
if update(T1_1)
BEGIN
--用游标,一个一个处理
DECLARE @fID int
DECLARE tmpGoods CURSOR for select ID from deleted
OPEN tmpGoods
FETCH NEXT FROM tmpGoods into @fID
WHILE @@FETCH_STATUS=0
BEGIN
--操作语句
update T1 set T1_2='32h4' where ID=@fID
FETCH NEXT FROM tmpGoods into @fID
END
CLOSE tmpGoods
DEALLOCATE tmpGoods
END
END
ON [dbo].[T1]
FOR UPDATE
AS
begin
if update(T1_1)
BEGIN
--用游标,一个一个处理
DECLARE @fID int
DECLARE tmpGoods CURSOR for select ID from deleted
OPEN tmpGoods
FETCH NEXT FROM tmpGoods into @fID
WHILE @@FETCH_STATUS=0
BEGIN
--操作语句
update T1 set T1_2='32h4' where ID=@fID
FETCH NEXT FROM tmpGoods into @fID
END
CLOSE tmpGoods
DEALLOCATE tmpGoods
END
END