一条跨库更新数据的sql
UPDATE [db1].[dbo].[R_ResAndBook]
SET SectionID=TT2.newsecid
FROM [SmartCampus].[dbo].[R_ResAndBook] AS TT1
INNER JOIN (SELECT newsecid,oldsecid FROM db2.table2) AS TT2
ON TT2.oldsecid=TT1.SectionID
SET SectionID=TT2.newsecid
FROM [SmartCampus].[dbo].[R_ResAndBook] AS TT1
INNER JOIN (SELECT newsecid,oldsecid FROM db2.table2) AS TT2
ON TT2.oldsecid=TT1.SectionID