March 1, 2005 at 5:39 am
I have a DTS package that runs a stored procedure to populate an employee table, what I want it to do is overwrite the existing table once a week or only add new employees and remove old. I figured the easiest way was to just rebuild the table each week, thus accomplishing all the tasks, but everytime I run it it just appends here is the stored procedure: Select * from mastEmployee where inactive='1'; This is set to copy from one table to another, but I want it to overwrite or update my second employee table.
Thanks in advance
March 1, 2005 at 7:33 am
if you are rebuilding the table you might use a step to truncate or delete the records in the table before you run the stored proc. With an empty table it will be easier to get what you need. Which statement you should use? Truncate or Delete? It depends of the table design. If you don't care about your logs, then use truncate if you do, use delete to make sure all your inserts and deltes are safe in your log in case you need to restore at any given time. One thing you need to be aware, I am assuming your table has a primary key. Is this key an identity field? if so and you want to keep your ID's almost the same as before (for relational purposes) you should run a dbcc checkident statement to reseed the id to the number you need ot have. Good luck
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply