June 2, 2010 at 10:50 pm
Hi
I want to add 2 columns to the existing table. How to do it?
I m using below query but getting error as given below. I m using sql server 2005
ALTER TABLE Transactionlog
ADD ( businessunit_id numeric(10,0),
businessunit_name varchar(250) );
------------------------------
ERROR
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '('.
June 2, 2010 at 10:59 pm
Sachin, remove the "( )" from your code ;
Sample code:
create table #temp1
(
a int
)
select * From #temp1
alter table #temp1 add b int , c int ;
select * from #temp1
June 2, 2010 at 10:59 pm
Change it like this
ALTER TABLE Transactionlog
ADD businessunit_id NUMERIC(10,0), businessunit_name VARCHAR(250)
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 2, 2010 at 11:06 pm
Thank u coldcoffee and kingston
It worked fine. Such a simple mistake 🙂
Thank u both
sachin
June 2, 2010 at 11:11 pm
You're welcome buddy 🙂
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply