dim mik
dim mik

Reputation: 959

Error with 'Alter Table' Command SQL Server

I am having a frustrating problem when I try to add a new column in an existing table named Groupon the SQL Server.

My command is the following:

ALTER TABLE Group
ADD languageID INT 

The error I get is the following:

Incorrect syntax near 'Group'. Expecting '.', ID, or QUOTED_ID

Any idea why is this happening ?

Upvotes: 0

Views: 242

Answers (5)

Alfaiz Ahmed
Alfaiz Ahmed

Reputation: 1726

ALTER TABLE [Group]
ADD languageID INT 

Upvotes: 1

Confused Mind
Confused Mind

Reputation: 26

Group is a sql reserved keyword. So it is giving syntax error as it is referring to that keyword. use this

ALTER TABLE [Group]
ADD languageID INT 

Or you can create different table with different name like Group1

Upvotes: 1

Oleg Lukash
Oleg Lukash

Reputation: 291

Group is a keyword in SQL Server. Please try this:

ALTER TABLE [Group]
ADD languageID INT 

Upvotes: 1

ahmed abdelqader
ahmed abdelqader

Reputation: 3568

Group is reserved word. put it into brackets, like next

ALTER TABLE [Group]
ADD languageID INT 

Upvotes: 3

Shakeer Mirza
Shakeer Mirza

Reputation: 5110

Since GROUP is a key word, you should not use it for Object names. If possible rename your table name to another name.

However try like below

ALTER TABLE [Group] ADD languageID INT 

Upvotes: 2

Related Questions