MERGE dimS AS T
USING ccservertbl AS S
ON (T.iAID = S.ServerID) OR (T.iAID = S.SID)
WHEN NOT MATCHED BY TARGET
THEN INSERT (
iAID,
ConfigItemName,
PropertyName,
NetWorkDomainName,
DataCenterTLA,
RetireValueIND,
AssetOnlyInd,
LastUpdatedDtim,
ODataServerID)
VALUES (
S.SID,
S.Name,
S.PropertyDimension,
S.NetworkDomain,
S.datacenterCode,
S.RetiredvalueInd,
S.IsAssetonly,
S.Modified,
S.ID)
WHEN MATCHED
THEN UPDATE
SET T.ConfigItemName = S.Name,
T.PropertyName = S.PropertyDimension,
T.NetWorkDomainName = S.NetworkDomain,
T.DataCenterTLA = S.datacenterCode,
T.RetireValueIND = S.RetiredvalueInd,
T.AssetOnlyInd = S.IsAssetonly,
T.LastUpdatedDtim = S.Modified,
T.ODataServerID = S.ID;
问问题
1391 次
1 回答
0
尽量不要访问整个对象dimS
和ccservertbl
.
例如替换
MERGE dimS AS T
USING ccservertbl AS S
和
;WITH TargetTable AS (
SELECT *
FROM dimS
WHERE <some slicing clause>
), SourceTable AS (
SELECT *
FROM ccservertbl
WHERE <some slicing clause>
)
MERGE TargetTable AS T
USING SourceTable AS S
于 2013-11-11T12:59:12.110 回答