首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sqlserver2005中批量批改表中的某个字段

2012-07-28 
sqlserver2005中批量修改表中的某个字段--创建临时表select billInfo.billId,billInfo.billTelephoneNumbe

sqlserver2005中批量修改表中的某个字段

--创建临时表
select billInfo.billId,billInfo.billTelephoneNumber,reportInfo.reportId,reportInfo.reportMobileTelephone
into temp
from billInfo,reportInfo
where billInfo.reportId = reportInfo.reportId

--修改BillInfo表
update billInfo set billTelephoneNumber = b.reportMobileTelephone
from billInfo a
inner join temp b
on a.billId=b.billId

--修改reportInfo表
update reportInfo set reportMobileTelephone = b.billTelephoneNumber
from reportInfo a
inner join temp b
on a.reportId=b.reportId

热点排行