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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Delete all records before inserting???

Author  Topic 

sahu74
Posting Yak Master

100 Posts

Posted - 2005-04-01 : 10:29:59
I have a DTS package that pulls records from another server into a table TBFac on MyServer. I would like to delete all the records from TBFac before I insert the new records after executing the DTS package. How can I do this?

Thank you.
PKS.

mfemenel
Professor Frink

1421 Posts

Posted - 2005-04-01 : 11:46:39
Add a custom sql step to your package and use "truncate table TBFac"

Mike
"oh, that monkey is going to pay"
Go to Top of Page

sahu74
Posting Yak Master

100 Posts

Posted - 2005-04-04 : 09:29:36
Thank you Mike.

PKS
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-04 : 23:34:35
Uhhh, are you sure this is a good idea???? From Books Online:

quote:

The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row. TRUNCATE TABLE removes the data by deallocating the data pages used to store the table's data, and only the page deallocations are recorded in the transaction log.



Just think about it before you hit GO.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -