Script to add new columns

I have a table product and below is the DDL.

CREATE TABLE [dbo].[Product](
 [Cust] [varchar](25) NULL,
 [Product] [varchar](20) NULL,
 [QTY] [int] NULL

select * from product


I am adding two new columns. One is the orders column with int as its type allowing nulls and the other is location with type nvarchar(100) and it is not nullable with default as ”. Below is the script:

ALTER TABLE dbo.[Product] ADD orders int NULL
ALTER TABLE dbo.[Product] ADD Location nvarchar(100) default '' NOT NULL

select * from product


Hope this helps

This entry was posted in SQL Server DBA Stuff and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s