Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jmarksamer
Starting Member
2 Posts |
Posted - 2007-08-17 : 14:38:23
|
| i'm trying to add an 'id' column that will auto_increment in a table that i've set up in sql enterprise server. i tried using the code:ALTER TABLE tablename ADD id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRSThowever, i get the following error:Server: Msg 170, Level 15, State 1, Line 1Line 1: Incorrect syntax near 'ID'.could someone please help (ASAP!!!) with how to fix this.thanks in advance for any help. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2007-08-17 : 14:50:48
|
| ALTER TABLE tablenameADD id int identity(1,1) not null,CONSTRAINT pk_id Primary key (id asc)Jim |
 |
|
|
|
|
|