Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Converting Int to BigInt on Primary Key

$
0
0

Hi guys,

I'm trying to find a way to convert from an INT to a BIGINT for a primary key.

I know the obvious suggestion of creating another table and migrating all the data, but that seems insane to me - there must be a better way.

My thoughts are adding a BIGINT column and copying the data just into that column, then dropping off the INT column; however, the problem is the clustered index.

The minute I change the clustered index, it's going to try to rebuild the entire table which will take an eternity.  The frustrating thing is, I know that the table will still be in the correct order, because the BIGINT column has the exact same data as the INT column.

Is there any way to recreate/modify a clustered index without rebuilding the entire table?  That is, can I force it, accepting the risks of doing so?

If there are any other thoughts on how I can convert this column, apart from an ALTER TABLE statement or migrating data, that'd be really appreciated.


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>