Sreedhar Danturthi
Sreedhar Danturthi

Reputation: 7601

Error while altering table in SQL Server

I'm just trying to add 2 columns to customer table

alter table CUSTOMER ADD ( CUSTOMERNAME VARCHAR(255) NULL
, CUSTOMERDESC VARCHAR(30) NULL )

but I get the following error when I try to run the script,

Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '('.

Can someone tell me what is the mistake that I'm doing. Thanks in anticipation

Upvotes: 0

Views: 1347

Answers (2)

marc_s
marc_s

Reputation: 755421

You don't need any ( before the column names - just use:

ALTER TABLE dbo.Customer 
ADD CustomerName VARCHAR(255) NULL, CustomerDesc VARCHAR(30) NULL 

Does that work?

Upvotes: 1

kaj
kaj

Reputation: 5251

You don't need the brackets for an alter statement so remove them. ie:

alter table CUSTOMER ADD   CUSTOMERNAME VARCHAR(255) NULL,   
CUSTOMERDESC VARCHAR(30) NULL 

Upvotes: 1

Related Questions