Well, it won’t be a quick’n’easy way to do this, really….
My approach would be this:
-
create a new table with identical structure – except for the
IDcolumn beingBIGINT IDENTITYinstead ofINT IDENTITY—-[ put your server into exclusive single-user mode here; user cannot use your server from this point on ]—-
-
find and disable all foreign key constraints referencing your table
-
turn
SET IDENTITY_INSERT (your new table) ON -
insert the rows from your old table into the new table
-
turn
SET IDENTITY_INSERT (your new table) OFF -
delete your old table
-
rename your new table to the old table name
-
update all table that have a FK reference to your table to use
BIGINTinstead ofINT(that should be doable with a simpleALTER TABLE ..... ALTER COLUMN FKID BIGINT) -
re-create all foreign key relationships again
-
now you can return your server to normal multi-user usage again