Groups | Blog | Home
all groups > sql server (alternate) > february 2004 >

sql server (alternate) : Large table schema changes


Sgt. Sausage
2/13/2004 2:59:20 PM
Quick question:

Does SQL do table/schema changes "in place"?

I've got a large table (140+ million rows of very wide
data) that we want to change the schema on -- basically
to remove a number of the unused data elements that we
don't use.

Anyway, does anyone know if SQL will do an in-place
change, or if it will copy the table to a new table, thereby
increasing my space allocation needs? I'd effectively,
temporarily, need space for two tables while the change
is happening if it copies the table first. This is not good as
I do not have enough available space at the moment.

If you've got pointers to specific MS docs regarding
this issue, please let me have 'em.

Thanks in advance.

Greg D. Moore (Strider)
2/13/2004 11:54:58 PM

[quoted text, click to view]

It depends.

If you're adding a nullable column generally it'll do it in place.

If you're adding a non-nullable column generally it'll make a copy.


[quoted text, click to view]

If you're dropping columns, I believe it will drop them in place.

[quoted text, click to view]

Simon Hayes
2/14/2004 11:32:20 AM

[quoted text, click to view]

You might want to check out this article by Kalen Delaney, which explains
ALTER TABLE in some detail:

http://www.sqlmag.com/Articles/Index.cfm?ArticleID=40538

Simon

AddThis Social Bookmark Button