SQL语句的问题
有两个表 
 表一         goods 
 id            name               number 
 1               CX05               15 
 2               DX55               20    
 3               UI99               8 
 表二      tempgoods 
 id            name               number 
 1               CX05               115 
 2               DX55               23    
 3               PPPP               999 
 4               UI99               18 
 5               PO88               22 
 现在要把tempgoods表中的数据更新到goods表中,可以看到,第二个表中的number   字段相对于第一个表是变化的,ID和name的值不变,而且第二个表的数据要多于第一个表,从上面看就是id3和id5的纪录是新增的,更新的时候要把第一个表中number字段与第二个表不同的数据替换为第二个表中的数据,比如表一id=1的记录number=15,而表二中id=1的记录number=115,更新的时候要把表一的number更新为115,而且把第二个表中的多于第一个表中的纪录插入第一个表中(例如id=3和id=5是新增的),请问存储过程如何写????
------解决方案--------------------update goods set number=tempgoods.number from tempgoods where goods.id=tempgoods.id 
 insert into goods select * from tempgoods where id not in (select id from goods)
------解决方案--------------------Create Procedure UpdataTableProc 
 AS 
 begin 
 Update goods Set number = tempgoods.number 
    From tempgoods where goods.id = tempgoods.id   
 Insert into goods  
 Select *  
   From tempgoods  
      Where not exists ( 
                      Select *  
                         From goods  
                          Where goods.id = tempgoods.id) 
 end