Skip to content
Advertisement

SQL server Change Column datatype on 1K million records

I am facing the column length issue in my table and I want to change column type to big int from int and table rows around 1K million records but when ever I tried to change data type it is taking to much time and it is eating my machine all space, what is best way and fast way to change the column data type on this big table, currently table has no indexes.

Currently Column length

ID 4(Length)   10(prec)

Tried I added new column and set their datatype to big int and made update query

Suggestion

Select insert into newtable is fact way but can we set column type with this query ?

Table Size :

76268200 74480.66    76260680    74473.32    7520    7.34

Advertisement

Answer

Issue resolved and its takes around less than 2 hours and resolved by following steps.

  • Create empty table with new Column Data type
  • Made around 21 batch scripts
  • Create clustered index on big int column
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement