If a table consist of identity column and reached max size then how you will solve it?
try alter the table column
ALTER TABLE OneTable ALTER COLUMN ID bigint
In case of primary key or FK dependency, it would fail with below error:
Msg 5074, Level 16, State 1, Line 1 The object ‘PK_OneTable’ is dependent on column ‘ID’. Msg 4922, Level 16, State 9, Line 1 ALTER TABLE ALTER COLUMN ID failed because one or more objects access this column.
Solution 1
- Create a new bigint column in the table
- Update that new column with the values from the int column
- Delete the int column
- Rename the bigint column
Ref:
https://www.sqlshack.com/solve-identity-crisis-sql-server/
Post a Comment
0 Comments