zoukankan      html  css  js  c++  java
  • 表一列数据根据其它表数据更新,备份表数据

    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

  • 相关阅读:
    HDU 1564 Play a game(巴什博弈)
    威佐夫博弈(Wythoff Game)
    产生冠军 hdoj_2094 巧用set
    find your present (感叹一下位运算的神奇)
    快速排序
    深度优先搜索(DFS)
    hdoj 2075 A|B?
    基础练习 特殊回文数
    10.Nginx Rewrite重写
    07.Nginx七层负载均衡
  • 原文地址:https://www.cnblogs.com/shiyh/p/7754089.html
Copyright © 2011-2022 走看看