ALTER COLUMN Runtime

The presence of a table with 60 columns and 200 rows. Changing a column BITfrom NULLto NOT NULLnow has a run time of more than 3 hours at startup. Why is it taking so long?

This is the request that I execute:

ALTER TABLE tbl
ALTER COLUMN col BIT NOT NULL

Is there a faster way to do this, besides creating a new column, updating it with the values ​​from the old column, then discarding the old column and renaming the new one?

This is on MS SQL Server 2005.

+3
source share
2 answers

ALTER , ? ALTER , .

Activity Monitor sys.dm_exec_requests , ALTER INDEX.

+3

3 ( ) 3 ?

, DBCC OPENTRAN: , , -,

SELECT * FROM sys.sysprocesses WHERE blocked <> 0 ,

+2

Source: https://habr.com/ru/post/1737416/


All Articles