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.
Author |
Topic |
learntsql
524 Posts |
Posted - 2012-08-15 : 03:33:39
|
Hi All,What is the best way/process to DROP/ADD the primary key constraint on the table which has around 14050975 records.TIA. |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-08-15 : 04:34:33
|
I take it that the PK is clustered which is the issue.Depends on the time and space available.One way would be to bcp the data out, truncate, drop all indexes, bcp in, add indexes - could be your only option.Another way would be to create another table, use a view to combine them then transfer data in batches at your leisure - you might find the view causes performance issues anyway.You could have another table as above, transfer the data in batches then as long as you have a means of knowing what has changed on the live table just transfer the remainder in the swapover.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|