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

  • 相关阅读:
    Array总结
    js 添加收藏
    js 浮点数
    chrome 不支持 input file cursor:pointer
    nginx proxy_set_header设置、自定义header
    docker常用命令
    ssh登录问题解决
    android10 搜索不到ble设备的问题解决
    go语言接口型函数使用
    树莓派gpio驱动
  • 原文地址:https://www.cnblogs.com/shiyh/p/7754089.html
Copyright © 2011-2022 走看看