Hi,
I need to inseet/update data froma staging table to another sql table. Can someone help please?
TIA
Isha
Hi,
I need to inseet/update data froma staging table to another sql table. Can someone help please?
TIA
Isha
What is the problem? Do you need assistance on creating the code or optimizing the code you have?
This sample code may be helpful to you.
MERGE
INTO Persons AS TARGET
USING Persons_Staging AS SOURCE
ON TARGET.ID = SOURCE.ID
--WHEN MATCHED
-- THEN UPDATE???
WHEN NOT MATCHED BY TARGET
THEN INSERT (Id , LastName , FirstName, HouseNumber)
VALUES (SOURCE.Id , SOURCE.LastName , SOURCE.FirstName, SOURCE.HouseNumber)
-- WHEN NOT MATCHED BY SOURCE
-- THEN DELETE???
;
Do you want to know the best practices to insert and update a large amount of data. You should go this blog here you may find the help. http://sqlblog.net/2014/05/01/insert-and-update-records-with-a-ssis-etl-package/