Add new columns while generating scripts in sql server 2008 -
i' trying generate scripts ma db in sql server 2008.. , i'm able that, scripts generated :
use [cab_booking] go /****** object: table [dbo].[user] script date: 05/19/2013 10:33:05 ******/ set ansi_nulls on go set quoted_identifier on go if not exists (select * sys.objects object_id = object_id(n'[dbo].[user]') , type in (n'u')) begin create table [dbo].[user]( [u_id] [int] identity(1,1) not null, [username] [nvarchar](50) not null, [password] [nvarchar](50) not null, add column new int not null, constraint [pk_user] primary key clustered ( [u_id] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] end go
what should if need add new column in table through scripts...
i know sounds easy...but, dont know missing...
thanks..
right click on table name on sql server management studio , select "design". add column using designer, don't save. right click anywhere on table designer , select "generate change script". have script required add new column table. method works removing columns, changing data types, etc.
Comments
Post a Comment