Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot add new column (Incorrect syntax near the keyword 'COLUMN')

When I run this

ALTER TABLE agency
ADD COLUMN single_word varchar(100)

I get

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'COLUMN'.

I tried removing the COLUMN but still same problem.

like image 834
Celeritas Avatar asked May 18 '12 18:05

Celeritas


2 Answers

For TSQL Flavor try this syntax:

ALTER TABLE agents
ADD [associated department] varchar(100)
like image 128
RThomas Avatar answered Nov 08 '22 14:11

RThomas


I have same issue when running that query on HeidiSQL. The solution is simple, change the query to be like this:

ALTER TABLE "agency"
ADD "single_word" varchar(100)

just remove "COLUMN" keyword.

like image 35
Ifan Iqbal Avatar answered Nov 08 '22 14:11

Ifan Iqbal