日期:2014-05-17  浏览次数:20399 次

sql server2008 存储过程
本帖最后由 win_1012 于 2013-11-20 20:32:29 编辑
ta
id          a      b                c
1          11      12               13
2          21      22               23
3          31      32               33
4          41      42               43
5          51      52               53

tb
id          a      b                c
1          111      12                13
2          21      222        23
3          31      32                333
4          41      42                43
5          555      52                53
以上是两张表、、如何写一个存储过程
将tb中的数据更新为ta的数据
在线等
急急急急急急急急。。。。。。。。。。。。。
存储过程

------解决方案--------------------
你有什么条件吗?没有条件用一条sql语句就可以了

update b
set a=a.a,b=a.b,c=a.c
from tb b
inner join ta a on a.id=b.id

------解决方案--------------------
delete from b

insert into b
select * from a
------解决方案--------------------
create proc change
as
begin
update ta set ta.a =tb.a, 
ta.b=tb.b,
ta.c=tb.c
from&n