Quote:
Originally posted by sks
Please help!
I have a table that has 32Million records and I need to extend the lenght of the Primary Key field to 31 instead of 24.
I am not able to alter table since the it's a Primary Key and there is an index on this field.
Can you please guide me on what might be the best option to change this field without dropping the table?
Thx!
SKS
|
If your original PK column is a varchar then you can simply alter column definition (you may need to drop and re-create PK). If it's a char then you could do it this way:
1) add a new column with the necessary datatype (I assume it's char(31))
2) copy contents of an existing PK column to the new column
3) drop PK constraint on the original PK column
4) created a unique index on the new column
5) add PK constraint on the new column
Don't forget to do a runstats afterwards in either case