Unfortunately, we're using SQL Server 2000...
We have a table with over 20 million rows in it, with each row having a datetime field (let's call it "TimeStamp"), containing the date and time when the row was created.
As the table is quite large, it makes doing queries on it very slow.
We would like to implement a system that archives off old data (e.g. where the row's timestamp is older than 3 months) to another identically structured table. We would also like to delete data from the archive table for over a certain age (e.g. delete rows that are more than 2 years old).
Considering that the table has many rows, what's the most efficient way of implementing this?
Is there a way of "moving" data from one table to another? i.e. Performing the archiving process in one step (a "move"), rather than two steps ("insert into archive table from select", then "delete" from original table).
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
you need to use table partitioning.
follow following link.
http://www.sqlskills.com/r
It would make sense if you first delete the data older than two years from your current table - you don't want to archive it and then delete it!
Make sure that there's an Index on the TimeStamp column.
There's no way that I'm aware of to 'Move' data. It has to be a two stage Insert then Delete.
declare @ArchiveDate date
select @ArchiveDate = dateadd(M,-3,getdate())
Insert Into ArchiveTable Select * from TheTable where Timestamp < @ArchiveDate
Delete from TheTable where Timestamp < @ArchiveDate
for SQL Server 2000
user following links
http://msdn.microsoft.com/
http://www.sqlteam.com/art
Business Accounts
Answer for Membership
by: dosukaPosted on 2009-09-30 at 02:31:41ID: 25456834
If you use MS SQL Server 2005, you may consider index and table partitioning to improve the query performance.
en-us/libr ary/ ms3451 46(SQL.90) .aspx#sql2 k5parti_to pic6
http://msdn.microsoft.com/