Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

Is ALTER TABLE ... DROP COLUMN really a metadata-only operation?

Asked by Anne Bell Apr 24, 2021 667 views 1 answer
Share

About this question

I've found several sources that state ALTER TABLE ... DROP COLUMN is a meta-data only operation. Is it? Source How can this be? Does the data during a DROP COLUMN not need to be purged from the underlying non-clustered indexes and clustered index/heap?

In addition, why do Microsoft Docs imply that it is a fully logged operation? The modifications made to the table are logged and fully recoverable. Changes that affect all the rows in large tables, such as dropping a column or, on some editions of SQL Server, adding a NOT NULL column with a default value, can take a long time to complete and generate many log records. Run these ALTER TABLE statements with the same care as any INSERT, UPDATE, or DELETE statement that affects many rows. As a secondary question: how does the engine keep track of dropped columns if the data isn't removed from the underlying pages? Is the drop column sql server a metadata-only operation?



Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.