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

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