Merge Query for two database in SQL Server


merge TargetDatabase.dbo.TableName as target


using(select * from SourceDataBase.dbo.SourceTable) as source on target.C1= source.C1


when NOT MATCHED BY SOURCE  then DELETE


when not matched then 


insert(C1)values(source.C1)


when MATCHED then


update set target.C1=source.C1;

Comments

Popular posts from this blog

This content database has a schema version which is not supported in this farm

Export all documents/Folders permissions to CSV using SharePoint PowerShell

SPUtility.js