Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Column Syntax Error

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
0
0
US
I'm trying to Script some changes for one of our databases, and this is what I'm typing:
Code:
ALTER TABLE [table_name]
ADD COLUMN [id] int IDENTITY(1,1) PRIMARY KEY NOT NULL
 GO

However, I receive an syntax error notification when I parse the code:
Code:
[COLOR=red]Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'COLUMN'.[/color]

But I don't see the syntax error there. When I remove the "Column" keyword, and try to execute the command, it tries to add "id" as a Constraint, rather than a column, but when I add the Column keyword, that is the error I receive.

Does anyone see what I'm doing wrong here?


-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top