forcing Management Studio to use alter table instead of drop/recreate

Posted by marco on Stack Overflow See other posts from Stack Overflow or by marco
Published on 2010-03-12T10:13:38Z Indexed on 2010/03/12 10:17 UTC
Read the original article Hit count: 269

Filed under:
|

Hi! I'm wondering if is there a way to force MSSQL Management Studio to produce a script like this:

ALTER TABLE Mytable
ADD MyCol bit NOT NULL
CONSTRAINT MyColDefault
DEFAULT 0 WITH VALUES


ALTER TABLE [dbo].Mytable
ALTER COLUMN MyCol2 int NULL

GO 

when I alter a very simple property of a column on a table. If I do this in the designer and ask for the produced script, the script doesn't do such simple tasks, but instead copies all the data in a tmp table, drops the original table, renames the tmp table with the original table name. And, of course, drops and recreates every constraint and relationships.

Is there any option I can change to change this behaviour? Or, this may be possible, is there some danger I don't see in using the simple ALTER TABLE above?

thanks.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql