zoukankan      html  css  js  c++  java
  • 1 sql server 中merge的用法

     MERGE 要更新的表名 AS target
       USING (
          这里是用什么数据源来跟新
    ) AS source ( 这里是数据源的所有列名 ) ON 这里是要更新的表和数据源的匹配条件

    WHEN MATCHED THEN
    UPDATE SET ContractSize = source.ContractSize,
    CurrencyId = source.CurrencyId,
    ISIN = source.ISIN,
    ContractName = source.ContractName,
    CountryId = source.CountryId,
    ISOExchangeCode = source.ISOExchangeCode,
    ExchangeRoot = source.ExchangeRoot,
    StrikePrice = source.StrikePrice,
    ExpirationDate = source.ExpirationDate,
    FeedSourceFileType = source.FeedSourceFileType,
    CallPut = source.CallPut,
    OSI = source.OSI,
    BloombergTicker = source.BloombergTicker,
    StandardContractName = source.StandardContractName,
    DetailTypeId = source.DetailTypeId,
    UnderlyingSecId = source.UnderlyingSecId,
    UnderlyingSecurityName = source.UnderlyingSecurityName,
    UnderlyingPerformanceId = source.UnderlyingPerformanceId,
    LastUpdate = GETDATE()

    
           WHEN NOT MATCHED THEN
               INSERT ( 要跟新的表的字段名
                            )
              VALUES (  
                用数据源的字段值来填充 ) ;分号不可以少
    --End Merge
  • 相关阅读:
    Java工具类
    集合 -- 嵌套表
    集合--索引表
    第一章
    记录Record
    序列Sequence
    操纵数据库 DML
    表的集合操作
    视图
    索引
  • 原文地址:https://www.cnblogs.com/mibing/p/7372288.html
Copyright © 2011-2022 走看看