Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Data Truncation Issue

Author  Topic 

baddulas
Starting Member

11 Posts

Posted - 2014-03-29 : 07:00:39
Hi all,

Please help on the below scenario.

Source - Oracle
Target - SQL Server

After every 2 hours data is truncating from target and loading the source data.Now i don't want to lose the target data.only matched records needs to be delete from target.

Which approach is best for the above scenario.

sqlsaga
Yak Posting Veteran

93 Posts

Posted - 2014-03-31 : 17:59:24
if you want to do it T-SQL way, write a query using MERGE JOIN.. See an example below...

http://sqlsaga.com/sql-server/how-to-capture-changes-between-source-and-destination-using-merge-statement/

You might change the Update and Inserts accordingly to DELETE and INSERTS.

If you want to do the SSIS way, you can use a LOOKUP Transformation and then a Conditional split and Delete / Insert accordingly with the Source.



Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Go to Top of Page
   

- Advertisement -