码迷,mamicode.com
首页 > 其他好文 > 详细

表内复制列

时间:2015-05-06 16:58:32      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

declare @tableA as table(
    item_name varchar(50),
    item_cname nvarchar(50)
)

insert @tableA (item_name, item_cname)
select  b.item_name, a.item_cname
 from [Tg_ExcelImport] a, Tg_ExcelImport b 
 where a.table_name = tg_staffinfo and  b.table_name = tg_staffinfo_temp and a.item_name = b.item_name
 
 update [Tg_ExcelImport] set item_cname =  (select item_cname from @tableA a
  where a.item_name = Tg_ExcelImport.item_name and Tg_ExcelImport.table_name = tg_staffinfo_temp)

 

表内复制列

标签:

原文地址:http://www.cnblogs.com/wertwang/p/4482196.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!