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 2008 Forums
 SQL Server Administration (2008)
 Partitioning an existing tables

Author  Topic 

Sean_B
Posting Yak Master

111 Posts

Posted - 2010-03-09 : 05:15:36
Hi,

I'm partitioning three existing tables of the following sizes

name rows data
TABLE 1 438,553,049 47 Gb
TABLE 2 493,707,180 70 Gb
TABLE 3 725,984,228 153 Gb

I've created the filegroups, partition function and scheme, now I need to get the data into the partitions.

The tables have a unique clustered index on two columns an integer columns and a datetime columns . I am using the datetime in the partition function.

My first attempt at moving the data was to drop the index and recreate it as a partitoned index thereby moving the data into the partitons.

However after running this for 18 hours doing Table 2, I stopped it.

I'm about to try a different approach and create new tables and then insert the data into them.

I'm going to use BCP or Bulk insert, to move the data.

However my table has a unique index with the date column, which is fine, but it also has a non clustered Primary key which is an identity column, and I get the following error when I try to create my new table on the partitions

Msg 1908, Level 16, State 1, Line 1
Column 'date' is partitioning column of the index 'PK_Trade'. Partition columns for a unique index must be a subset of the index key.

from reading a previous link in the forums http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115639
other people have come across this, is there any way around this ?

I notice that it will let you have this primary key if you move the data using re indexing.

Is there anyway I can preserve this primary key as is but still use the bulk insert approach ?

Any help or suggestions appreciated.


Sean

Sean_B
Posting Yak Master

111 Posts

Posted - 2010-03-09 : 08:45:31


I changed it from the primary key to a unique index on the primary filegroup, don't know why I didn't think of that to start with.

Sean
Go to Top of Page
   

- Advertisement -