Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Script Table As -> ALTER To - grayed out??? Why? Expand / Collapse
Author
Message
Posted Wednesday, July 14, 2010 1:52 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 10:25 AM
Points: 272, Visits: 1,083
I am using SSMS 2008 and went to add some new columns to a table.

I can do this in the design view, but why can't I script an ALTER statement?

Just adding new columns shouldn't require the table to be dropped or suffer any "massive changes"?

I Googled a bit and it said if I use design it will copy all the data to a temp location, drop, then recreate the table.

So I assume it will preserve all PKIDs, but what if I had a 16 TB table, that would be a MASSIVE disk I/O operation...

Am I missing something here?
Post #952677
Posted Wednesday, July 14, 2010 3:02 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:12 PM
Points: 42,481, Visits: 35,550
Script Table As -> ALTER To - grayed out??? Why?


Probably because the only portion that could be sensibly scripted out without further knowing what you're doing would be

ALTER TABLE <Table name>

The rest of the command completely differs depending whether you want to add columns, alter a column, drop a column, add a constrain, drop a constraint, enable or disable a trigger, enable or disable change tracking, switch a partition, rebuild the table or set a table option.

I Googled a bit and it said if I use design it will copy all the data to a temp location, drop, then recreate the table.

So I assume it will preserve all PKIDs, but what if I had a 16 TB table, that would be a MASSIVE disk I/O operation...


Which is why most people will write the alter table statement themselves and leave the designer where it should be - closed.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #952722
Posted Friday, April 19, 2013 12:46 PM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 23, 2013 5:53 AM
Points: 9, Visits: 35
Wonder why it's even on that menu anyway, then...??
Post #1444562
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse