@a=select A12 from A1 if(@a==null)begin update a2 set a21=select a11 from a1 update a1 set a12=select a22 from a2end好久没写SQL了大概就是这个意思,也许有一些语法的错误,你知道的很久没写了忘了很正常