Question:
Help with SQL syntax error?
Jack Ross
2011-02-25 17:15:41 UTC
A friend gave me a code that I could use for my site for SQL Server Management Studio Express:

CREATE TABLE mail (
UserTo tinytext NOT NULL,
UserFrom tinytext NOT NULL,
Subject mediumtext NOT NULL,
Message longtext NOT NULL,
status text NOT NULL,
SentDate text NOT NULL,
mail_id int(80) NOT NULL auto_increment,
PRIMARY KEY (mail_id)
) TYPE=MyISAM;


But I get this error message:
Msg 102, Level 15, State 1, Line 9
Incorrect syntax near 'auto_increment'.

I've only used sql a couple times before, but someone else made the scripts for me. Help would be very much appreciated :)
Four answers:
TheMadProfessor
2011-02-28 09:16:55 UTC
Your friend was probably using MySQL. Try using IDENTITY instead of auto_increment
?
2016-06-20 16:33:21 UTC
You've gotten a comma proper before your FROM clause, that is what MySQL is complaining about proper now. Drop the comma at the end of this line: cs.Course_Session_id, cs.Course_Course_id, on the way to get rid of the primary error. I'm a little uncertain about this line: americaCourse_Session_Course_Session_id = '".$Course_Session_id."' nevertheless it might work.
Serge M
2011-02-26 08:21:27 UTC
This code is for MySQL I think, but not for SQL Server.

You should transform it before using.
Silviu M
2011-02-25 17:29:31 UTC
I think it should be capital, AUTO_INCREMENT


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...