Jump to content

Incorrect syntax near 'auto_increment'??


Recommended Posts

I keep getting the error: Incorrect syntax near 'auto_increment'

 

Here is the code:

$createTable="CREATE TABLE internalKB (id tinyint( 4 ) NOT NULL auto_increment, title VARCHAR( 255 ), body LONGTEXT, datnum TIMESTAMP( 14 ), user VARCHAR( 100 ), category VARCHAR( 50 ), PRIMARY KEY ( id )) TYPE = MYISAM ";

 

Whenever I run a query with that, I get that error. I can't see anything that should be a problem, but I must be missing something.

Link to comment
https://forums.phpfreaks.com/topic/2546-incorrect-syntax-near-auto_increment/
Share on other sites

Continued to research after I posted and got it to work this way:

 

$createTable="CREATE TABLE internalKB (id int NOT NULL identity, title VARCHAR( 255 ), body TEXT, datnum TIMESTAMP, inputby VARCHAR( 100 ), category VARCHAR( 50 ), PRIMARY KEY ( id )) ";

 

The problem is that I'm using msSQL instead of mySQL, so there are TONS of tiney differances in syntax that I pretty much have to figure out on my own because msSQL isn't nearly as well used and discussed as mySQL!

 

Whew! Good thing everybody else in the office was gone when I finally got it to work, or they would have thought I was NUTS!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.