Groups | Blog | Home
all groups > sql server data warehouse > july 2005 >

sql server data warehouse : Create table, remove records?



vidro
7/7/2005 6:55:09 AM
SQL 2000;

I have a table that has info from 2001 thru 2005, I want to create new
tables and move records from the original table to the new tables, based on
year.
What is the best way to do this?

JT
7/7/2005 10:44:07 AM
1. Create empty tables for 2001 to 2005 with record structures identical
to the original and no indexes.

2. For each table, do something like the following:
insert into SALES_2001 select * from SALES where period = 2001

3. Create indexes to the new tables.

Since you are inserting into new tables, you could also temporarily set the
database recovery model to "simple". If there are millions of rows, this
will reduce transaction logging and speed things up.

[quoted text, click to view]

Danny
7/8/2005 11:51:25 AM
Same advice JT gave you except if the table structures are the same use
select into instead of create table and insert into.

[quoted text, click to view]

AddThis Social Bookmark Button