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