Reputation: 959
I am having a frustrating problem when I try to add a new column in an existing table named Group
on 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
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
Reputation: 291
Group is a keyword in SQL Server. Please try this:
ALTER TABLE [Group]
ADD languageID INT
Upvotes: 1
Reputation: 3568
Group is reserved word. put it into brackets, like next
ALTER TABLE [Group]
ADD languageID INT
Upvotes: 3
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