SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Script Table As -> ALTER To - grayed out??? Why?


Script Table As -> ALTER To - grayed out??? Why?

Author
Message
Maxer
Maxer
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 Visits: 1603
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?
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86292 Visits: 45232
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, MVP, M.Sc (Comp Sci)
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


brian.battles
brian.battles
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 35
Wonder why it's even on that menu anyway, then...??
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search