declare @Mno as nvarchar(100), @A as nvarchar(100), @b as nvarchar(100), @c as nvarchar(100), @d as nvarchar(100) select @Mno=Mno,@A=A,@B=B,@C=C,@D=D from t2 where 条件 update t1 set Mno=@Mno,A=@A,B=@B,C=@C,D=@D where 条件
update T1 set a.A =b.A, a.B =b.B, a.C =b.C, a.D =b.D from t1 a,t2 b where a.mno = b.mno 以上是更新,插入就不用说了吧!
楼上在更新列名前使用的前缀只怕通过过更新t1中某条的纪录update t1 set A=T2.A, B=T2.B, C=T2.C, D=T2.D from T2 where T1.Pno=T2.Mno
对不起,我也错了!更新t1中某条的纪录update t1 set t1.A=T2.A, t1.B=T2.B, t1.C=T2.C, t1.D=T2.D from T2 where T1.Pno=T2.Mno
update T1 set a.A =b.A, a.B =b.B, a.C =b.C, a.D =b.D from t1 a,t2 b where a.mno = b.mno
to noil0125(珏心) : 是吗?你试了吗?是可以的!你可以查下TSQL的帮助!
update T1 set A =b.A, B =b.B, C =b.C, D =b.D from t1 a,t2 b where a.mno = b.mno
update a set a.A =b.A, a.B =b.B, a.C =b.C, a.D =b.D from t1 a,t2 b where a.mno = b.mno
@Mno as nvarchar(100),
@A as nvarchar(100),
@b as nvarchar(100),
@c as nvarchar(100),
@d as nvarchar(100)
select @Mno=Mno,@A=A,@B=B,@C=C,@D=D from t2 where 条件
update t1 set Mno=@Mno,A=@A,B=@B,C=@C,D=@D where 条件
from t1 a,t2 b
where a.mno = b.mno
以上是更新,插入就不用说了吧!
set A=T2.A,
B=T2.B,
C=T2.C,
D=T2.D
from T2 where T1.Pno=T2.Mno
set t1.A=T2.A,
t1.B=T2.B,
t1.C=T2.C,
t1.D=T2.D
from T2 where T1.Pno=T2.Mno
from t1 a,t2 b
where a.mno = b.mno
A =b.A,
B =b.B,
C =b.C,
D =b.D
from t1 a,t2 b
where a.mno = b.mno
from t1 a,t2 b
where a.mno = b.mno