sqlsql-serverdatabasesqlperformance

Rename a table column that has a huge amount of data in SQL


I want to change column of table that table has more than 5 millions records. this column related to a few indexes and I have to drop these indexes and rename column and after that recreate indexes. this process take to much time. almost 1:30 hour. does have better solution to rename that column with better performance?


Solution

  • Create an empty table with the correct definition. Select old data into the table with the correct structure. DROP old table.