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

  • 相关阅读:
    Leetcode 12. Integer to Roman
    Leetcode 133. Clone Graph
    Leetcode 199. Binary Tree Right Side View
    Leetcode 200. Number of Islands
    React通过Ajax获取数据
    canvas鼠标点击划线
    制作图片墙
    CSS制作翻牌特效
    输入框制作方法
    初来咋到
  • 原文地址:https://www.cnblogs.com/shiyh/p/7754089.html
Copyright © 2011-2022 走看看