×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Needed Help with SQL Syntax

Needed Help with SQL Syntax

Needed Help with SQL Syntax

(OP)
Hello all, this is my first post.

I am currently trying to upload a database for a site I am working on however I constantly get the same error. My coding knowledge is close to nothing in relation to SQL.

I will provide the code that gives the error and the error in question:

"SQL-query:

CREATE TABLE mos_components(
id int( 11 ) NOT NULL AUTO_INCREMENT ,
name varchar( 50 ) NOT NULL default '',
link varchar( 255 ) NOT NULL default '',
menuid int( 11 ) unsigned NOT NULL default '0',
parent int( 11 ) unsigned NOT NULL default '0',
admin_menu_link varchar( 255 ) NOT NULL default '',
admin_menu_alt varchar( 255 ) NOT NULL default '',
OPTION varchar( 50 ) NOT NULL default '',
ordering int( 11 ) NOT NULL default '0',
admin_menu_img varchar( 255 ) NOT NULL default '',
iscore tinyint( 4 ) NOT NULL default '0',
params text NOT NULL ,
PRIMARY KEY ( id )
) TYPE = MYISAM

MySQL said: Documentation
#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'option varchar(50) NOT NULL default '',
  ordering int(11) NOT"



If anyone can help, I'd greatly appreciate.

Regards,
Ederico.

RE: Needed Help with SQL Syntax

'Option' is a reserved word and cannot be used as a column name.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Needed Help with SQL Syntax

(OP)
Any idea of what it should be then? That database was functioning perfectly on my old server, but it does not upload on the new one.

RE: Needed Help with SQL Syntax

(OP)
What happens if I change that? Would I have to modify other code?

RE: Needed Help with SQL Syntax

(OP)
Can anyone answer my questions? My coding knowledge is practically inexistant.

RE: Needed Help with SQL Syntax

Simply change 'option' to something else.

CREATE TABLE mos_components(
id int( 11 ) NOT NULL AUTO_INCREMENT ,
name varchar( 50 ) NOT NULL default '',
link varchar( 255 ) NOT NULL default '',
menuid int( 11 ) unsigned NOT NULL default '0',
parent int( 11 ) unsigned NOT NULL default '0',
admin_menu_link varchar( 255 ) NOT NULL default '',
admin_menu_alt varchar( 255 ) NOT NULL default '',
Opt_Code varchar( 50 ) NOT NULL default '',
ordering int( 11 ) NOT NULL default '0',
admin_menu_img varchar( 255 ) NOT NULL default '',
iscore tinyint( 4 ) NOT NULL default '0',
params text NOT NULL ,
PRIMARY KEY ( id )
) TYPE = MYISAM

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Needed Help with SQL Syntax

(OP)
I get the following error now, I hope you can help:

 SQL-query:

--
-- Table structure for table `mos_content`
--
CREATE TABLE mos_content(
id int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
title varchar( 100 ) NOT NULL default '',
title_alias varchar( 100 ) NOT NULL default '',
introtext mediumtext NOT NULL ,
FULLTEXT mediumtext NOT NULL ,
state tinyint( 3 ) NOT NULL default '0',
sectionid int( 11 ) unsigned NOT NULL default '0',
mask int( 11 ) unsigned NOT NULL default '0',
catid int( 11 ) unsigned NOT NULL default '0',
created datetime NOT NULL default '0000-00-00 00:00:00',
created_by int( 11 ) unsigned NOT NULL default '0',
created_by_alias varchar( 100 ) NOT NULL default '',
modified datetime NOT NULL default '0000-00-00 00:00:00',
modified_by int( 11 ) unsigned NOT NULL default '0',
checked_out int( 11 ) unsigned NOT NULL default '0',
checked_out_time datetime NOT NULL default '0000-00-00 00:00:00',
publish_up datetime NOT NULL default '0000-00-00 00:00:00',
publish_down datetime NOT NULL default '0000-00-00 00:00:00',
images text NOT NULL ,
urls text NOT NULL ,
attribs text NOT NULL ,
version int( 11 ) unsigned NOT NULL default '1',
parentid int( 11 ) unsigned NOT NULL default '0',
ordering int( 11 ) NOT NULL default '0',
metakey text NOT NULL ,
metadesc text NOT NULL ,
access int( 11 ) unsigned NOT NULL default '0',
hits int( 11 ) unsigned NOT NULL default '0',
PRIMARY KEY ( id ) ,
KEY idx_section( sectionid ) ,
KEY idx_access( access ) ,
KEY idx_checkout( checked_out ) ,
KEY idx_state( state ) ,
KEY idx_catid( catid ) ,
KEY idx_mask( mask )
) TYPE = MYISAM

MySQL said: Documentation
#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'mediumtext NOT NULL,
  state tinyint(3) NOT NULL default '0',


I hope you can help to make this database function, I wonder what is wrong, the db works perfectly on the old server, no problems there.

Regards,
Edric.

RE: Needed Help with SQL Syntax

Quote (Ederico):

the db works perfectly on the old server,
What database manager is running on the old server?  Is is SQL Server, Oracle, MS Access, MySQL, or another product.  I suspect that it is not MySQL and you are running into differences between two different database management products.  Different products have different idiosyncrasies and if you converting from one to another, you need to brush up on those differences.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Needed Help with SQL Syntax

It's the same error as before... you have a label in front of the line it's claiming the error is on.  Check this label.  Are you reading any of the documentation for MySQL?

Dan
Owner
http://www.Hi-TecDesigns.com

RE: Needed Help with SQL Syntax

(OP)
@CajunCenturion,

I will check what version I had on the old server, unfortunately to answer I rely on other person as the old server is not in my control.

@macgyvers2000

I presume the error is FULLTEXT, I'll attempt changing that, I still have the original backup, and I can get the backup directly from the old server if I desire.

Thanks for your help, guys.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources