不好意思,刚没说清楚,这样的
table1
--------
id name
--------
1 aaa
2 bbb
3 ccc
就是我执行update table1 set name='abc' where id='1'时
id=3的name也变成abc
用触发器完成
table1
--------
id name
--------
1 aaa
2 bbb
3 ccc
就是我执行update table1 set name='abc' where id='1'时
id=3的name也变成abc
用触发器完成
for update
as
if update(name) and exists(select 1 from inserted where id=1)
update table1 set name=(select top 1 name from inserted where id=1)
where id=3
CREATE TRIGGER [a] ON [table1]
FOR UPDATE
AS
DECLARE @up VARCHAR(14)
select @up=[name] from inserted
if update ([name])update table1 set [name]=@up from table1 where id='3'