MERGE INTO cms_universal_metadata AS Target
USING cms_universal_metadata_stage AS Source
ON Target.asset_folder_hash =Source.stg_asset_folder_hash
-- AND Target.Mid =Source.Mid
WHEN MATCHED THEN
UPDATE SET Target.asset_folder_path = Source.stg_asset_folder_path ,
Target.a_archive = Source.stg_a_archive,
Target.acl_name = Source.stg_acl_name
WHEN NOT MATCHED BY Target THEN
INSERT (asset_folder_path,a_archive,acl_name)
VALUES (Source.stg_asset_folder_path,Source.stg_a_archive,Source.stg_a_archive);
我有一个自动化ssis包,需要从登台表复制到目标表。如果再次从登台复制到目的地那个时候如果有相同的记录那么它应该更新,否则它将是insert.please任何人帮助我吗?
答案 0 :(得分:0)
尝试使用Lookup transformation
转换OLEDB command
来更新现有记录。
了解:
慢慢改变尺寸 - https://msdn.microsoft.com/en-us/library/ms141715.aspx
T-SQL MERGE - https://msdn.microsoft.com/en-us/library/bb510625.aspx
答案 1 :(得分:0)