Unix Technical Forum

What is wrong with this command ?

This is a discussion on What is wrong with this command ? within the MySQL forums, part of the Database Server Software category; --> I made a mysqldump with version 3. I want to import this into version 4 but I get an ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 08:16 AM
R.Smits
 
Posts: n/a
Default What is wrong with this command ?

I made a mysqldump with version 3. I want to import this into version 4 but
I get an error. Does anyone know why this doesn't work ?
-----
mysql> CREATE TABLE mod_banner (
-> banner_id bigint(20) NOT NULL auto_increment,
-> titel varchar(255) NOT NULL default '',
-> mod bigint(20) NOT NULL default '0',
-> id bigint(20) NOT NULL default '0',
-> url varchar(255) NOT NULL default '',
-> PRIMARY KEY (banner_id)
-> ) TYPE=MyISAM;
ERROR 1064 (42000): 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 'mod bigint(20) NOT NULL default '0',
id bigint(20) NOT NULL default '0',
url' at line 4

Thank you for any help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 08:16 AM
Peter van Schie
 
Posts: n/a
Default Re: What is wrong with this command ?

R.Smits schreef:
> I made a mysqldump with version 3. I want to import this into version 4 but
> I get an error. Does anyone know why this doesn't work ?
> -----
> mysql> CREATE TABLE mod_banner (
> -> banner_id bigint(20) NOT NULL auto_increment,
> -> titel varchar(255) NOT NULL default '',
> -> mod bigint(20) NOT NULL default '0',
> -> id bigint(20) NOT NULL default '0',
> -> url varchar(255) NOT NULL default '',
> -> PRIMARY KEY (banner_id)
> -> ) TYPE=MyISAM;
> ERROR 1064 (42000): 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 'mod bigint(20) NOT NULL default '0',
> id bigint(20) NOT NULL default '0',
> url' at line 4


Hi,

The problem is the column named 'mod'. MOD is also a MySQL operator, so
you cannot use it as a column-name. Change it into a valid name and
you're all set.

HTH.
Peter.
--
http://www.phpforums.nl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 08:16 AM
Peter H. Coffin
 
Posts: n/a
Default Re: What is wrong with this command ?

On Fri, 29 Sep 2006 01:03:23 +0200, Peter van Schie wrote:
> R.Smits schreef:
>> I made a mysqldump with version 3. I want to import this into version 4 but
>> I get an error. Does anyone know why this doesn't work ?
>> -----
>> mysql> CREATE TABLE mod_banner (
>> -> banner_id bigint(20) NOT NULL auto_increment,
>> -> titel varchar(255) NOT NULL default '',
>> -> mod bigint(20) NOT NULL default '0',
>> -> id bigint(20) NOT NULL default '0',
>> -> url varchar(255) NOT NULL default '',
>> -> PRIMARY KEY (banner_id)
>> -> ) TYPE=MyISAM;
>> ERROR 1064 (42000): 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 'mod bigint(20) NOT NULL default '0',
>> id bigint(20) NOT NULL default '0',
>> url' at line 4

>
> Hi,
>
> The problem is the column named 'mod'. MOD is also a MySQL operator, so
> you cannot use it as a column-name. Change it into a valid name and
> you're all set.


Additionally, '0' is not a valid bigint default value. It's not valid
for int or any other numeric type either. '0' is a character, not a
number.

--
45. I will make sure I have a clear understanding of who is responsible for
what in my organization. For example, if my general screws up I will not
draw my weapon, point it at him, say "And here is the price for failure,"
then suddenly turn and kill some random underling. --Evil Overlord List
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:15 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com