Sunday, March 11, 2012

Alter Table

Simple SQL question.

I am trying to add multiple columns to a temp table and the alter statement throws the following error.

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '('.

The alter statement looks like this.

ALTER TABLE #BillingData ADD (T2 FLOAT, T3 varchar(20) NULL)

I thought you can add multiple columns putting the names in ( ).

Any ideas where I am doing wrong.

Thanks.

Quote:

Originally Posted by ymk

Simple SQL question.

I am trying to add multiple columns to a temp table and the alter statement throws the following error.

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '('.

The alter statement looks like this.

ALTER TABLE #BillingData ADD (T2 FLOAT, T3 varchar(20) NULL)

I thought you can add multiple columns putting the names in ( ).

Any ideas where I am doing wrong.

Thanks.


hi ymk,
remove the brackets after add. just
alter table #billingdata add t2 float,t3 varchar(20) null

No comments:

Post a Comment