In SQL Server 2008, I have a table with about 3 million records. I want to change the type of one of my columns from float to int. But it looks like it will take a long time. Is there any way to do this very fast?
Drop any constraints, indexes, and triggers for this table; they also slow down the update.
Add a new int column to the table, update the new column to the value of the old column, delete the old column, rename the new column.
I have a feeling that it will be faster, but I could be wrong!
, float, .
" " .
, , .
, , SSMS . . , SSMS -, , .
The ALTER table is usually faster than using SSMS. In any case, I agree with doogstar, since you need to convert all the data to int, I would create a new column to populate it (which you can do in batches to improve performance and prevent table locking), then discard the old column and rename new.
Source: https://habr.com/ru/post/1728171/More articles:Can someone explain ja_JP.UTF8? - character-encodingNo default date in SWT DateTime - javaHow to specify encoding during csv file process in PHP? - phpUnique identifier and multiple classes with XPath - classEmacs VCS interface captures only one file - version-controlopen link inside iframe in new windows - htmlHow can I get a callback when there is some data to read in the boost.asio stream without reading it into the buffer? - boostEmbedding the Zend Permanent Login Form - loginCalculation of the Fourier transform at any frequency - mathManually issue a token with ANTLR - compiler-constructionAll Articles