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)
 Delete oneset of records from Table

Author  Topic 

kond.mohan
Posting Yak Master

213 Posts

Posted - 2014-06-14 : 03:48:47
Hi ,
i has created ssis pkg for dataloading from oracle to sql server.one of my table Executed(inserted same transction day Records) twice into sql server table.we need to Delete oneset of Records from Sql server table for that specific day. i have used below manner to insert into table
insert into tablename
Select * from tablenaem where tran_date = trunk(sysdate -1 )
example
above query Executed twice in a day.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-14 : 17:56:52
Is there a column, such as an identity column, that will help determine which is in the second set?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

BBarn
Starting Member

14 Posts

Posted - 2014-06-16 : 08:07:07
Select DISTINCT into a temporary table (By Date? or any field(s) combination that gets you the doubled up transactions).

DELETE from the original table and INSERT INTO back to the main table from your TEMP table.
Go to Top of Page
   

- Advertisement -