I am looking to perform the following tasks in order to "archive" records from a production table to an archive table (both tables with the same definition) and am not sure if it would be best to do this through UDFs or Stored Procedures.
-Select all of the records from the production table that have a bit field (checkbox) with a value = 1 from the production table
-Set the identity insert on in the archive table
-Insert these records into the archive table
-Delete out the records that were selected and inserted into the archive table from the production table.
-Turn off the identity insert on the the archive table.
I have started to do this by opening up a cursor containing the records that I am wanting to archive, and was looking to create a stored procedure to walk through the cursor, but I wasn't sure if this was the most efficient way to do this (500 - 2500) records each time.
I am working in SQL 2000. Any thoughts? Thanks for your input.
nickela
-Select all of the records from the production table that have a bit field (checkbox) with a value = 1 from the production table
-Set the identity insert on in the archive table
-Insert these records into the archive table
-Delete out the records that were selected and inserted into the archive table from the production table.
-Turn off the identity insert on the the archive table.
I have started to do this by opening up a cursor containing the records that I am wanting to archive, and was looking to create a stored procedure to walk through the cursor, but I wasn't sure if this was the most efficient way to do this (500 - 2500) records each time.
I am working in SQL 2000. Any thoughts? Thanks for your input.
nickela