update [ResourceInfo] set[ResourceName]=replace(ResourceName,'''''','''')
update b set [ResourceName]=a.[ResourceName] from [ResourceInfobak] a,[ResourceInfo] b where a.[ResourceGuid]=b.[ResourceGuid]
SET IDENTITY_INSERT [ResourceInfo] off
update c set c.[ResourceGuid]=b.[ResourceGuid] from Replancebak b, ResourceInfo c where b.ResourceName=c.ResourceName
--备份表已存在
Insert into [ResourceInfo] ([ResourceInfoID]
,[ResourceGuid]
,[ResourceName]
,[ResourceType]
,[UpdateUser])select [ResourceInfoID]
,[ResourceGuid]
,[ResourceName]
,[ResourceType]
,[UpdateUser] from [ResourceInfobak]
--备份表不存在
SELECT * into AgreementResourcebak from AgreementResource
SELECT * into ResourceInfobak from ResourceInfo
--更新协议资源表
update a set a.[ResourceGuid]=b.[ResourceGuid] from AgreementResource a, Replance b, ResourceInfo c where a.[ResourceGuid]=c.[ResourceGuid] and b.ResourceName=c.ResourceName
--更新资源表
update c set c.[ResourceGuid]=b.[ResourceGuid] from Replance b, ResourceInfo c where b.ResourceName=c.ResourceName