4 Replies - 1463 Views - Last Post: 12 August 2009 - 08:42 AM

#1 evinrows   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 141
  • Joined: 03-August 09

Problem with large database query.

Posted 12 August 2009 - 07:33 AM

Okay, so I am trying to do this very large query generated from a csv to MySQL translator. The query is as follows:

#  
# MySQL-Dump created by SQL Database Import Utility, 1.0.44, Host-ID: 3cc14929
# HTTP-Host: www.sqldbu.com
# Date: 2009-08-12 16:17:46
# --------------------------------------------------------
#  
#  
CREATE TABLE IF NOT EXISTS 06 (Name CHAR(16) NOT NULL default '', Cabo DECIMAL(4,0) NOT NULL, LBI DECIMAL(4,0) NOT NULL, OBX DECIMAL(4,0) NOT NULL, Aliso DECIMAL(4,0) NOT NULL, Dewey DECIMAL(4,0) NOT NULL, Vilano DECIMAL(4,0) NOT NULL, Santa_Cruz DECIMAL(4,0) NOT NULL, Balboa DECIMAL(4,0) NOT NULL, Total DECIMAL(4,0) NOT NULL, RECNO INT(10) unsigned NOT NULL auto_increment, PRIMARY KEY (RECNO) );
SET sql_mode='';
INSERT INTO 06 SET Name='',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=0;
INSERT INTO 06 SET Name='Paulo Prietto',Cabo=900,LBI=1000,OBX=900,Aliso=1620,Dewey=656,Vilano=282,Santa_Cruz=810,Balboa=1000,Total=7168;
INSERT INTO 06 SET Name='James Lovett',Cabo=1000,LBI=0,OBX=1000,Aliso=1800,Dewey=0,Vilano=0,Santa_Cruz=900,Balboa=900,Total=5600;
INSERT INTO 06 SET Name='Grady Archbold',Cabo=656,LBI=478,OBX=729,Aliso=1181,Dewey=729,Vilano=314,Santa_Cruz=229,Balboa=282,Total=4598;
INSERT INTO 06 SET Name='Bill Bryan',Cabo=531,LBI=0,OBX=0,Aliso=2000,Dewey=0,Vilano=0,Santa_Cruz=1000,Balboa=810,Total=4341;
INSERT INTO 06 SET Name='Chris Marciniak',Cabo=254,LBI=810,OBX=313,Aliso=300,Dewey=1000,Vilano=656,Santa_Cruz=254,Balboa=430,Total=4017;
INSERT INTO 06 SET Name='Morgan Just',Cabo=349,LBI=900,OBX=0,Aliso=458,Dewey=810,Vilano=729,Santa_Cruz=89,Balboa=656,Total=3991;
INSERT INTO 06 SET Name='Brendan Stevens',Cabo=810,LBI=0,OBX=0,Aliso=1312,Dewey=0,Vilano=0,Santa_Cruz=531,Balboa=531,Total=3184;
INSERT INTO 06 SET Name='Jason Wilson',Cabo=430,LBI=531,OBX=656,Aliso=0,Dewey=900,Vilano=387,Santa_Cruz=0,Balboa=89,Total=2993;
INSERT INTO 06 SET Name='George Bryan',Cabo=729,LBI=0,OBX=590,Aliso=1063,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=590,Total=2972;
INSERT INTO 06 SET Name='Koty Lopez',Cabo=590,LBI=0,OBX=0,Aliso=861,Dewey=0,Vilano=0,Santa_Cruz=349,Balboa=387,Total=2187;
INSERT INTO 06 SET Name='Corbin Dull',Cabo=0,LBI=0,OBX=810,Aliso=0,Dewey=387,Vilano=810,Santa_Cruz=0,Balboa=150,Total=2157;
INSERT INTO 06 SET Name='Joe Vavala',Cabo=185,LBI=729,OBX=430,Aliso=0,Dewey=590,Vilano=0,Santa_Cruz=0,Balboa=150,Total=2084;
INSERT INTO 06 SET Name='Brandon Sears',Cabo=229,LBI=0,OBX=0,Aliso=334,Dewey=0,Vilano=0,Santa_Cruz=729,Balboa=729,Total=2021;
INSERT INTO 06 SET Name='Brandon Rothe',Cabo=206,LBI=0,OBX=0,Aliso=697,Dewey=0,Vilano=0,Santa_Cruz=656,Balboa=314,Total=1873;
INSERT INTO 06 SET Name='Keith Fowler',Cabo=135,LBI=0,OBX=0,Aliso=1458,Dewey=0,Vilano=0,Santa_Cruz=150,Balboa=0,Total=1743;
INSERT INTO 06 SET Name='Brad Evers',Cabo=0,LBI=0,OBX=531,Aliso=270,Dewey=0,Vilano=900,Santa_Cruz=0,Balboa=0,Total=1701;
INSERT INTO 06 SET Name='Dominic Prietto',Cabo=387,LBI=0,OBX=0,Aliso=508,Dewey=0,Vilano=0,Santa_Cruz=478,Balboa=229,Total=1602;
INSERT INTO 06 SET Name='Bill Baxter',Cabo=0,LBI=387,OBX=185,Aliso=0,Dewey=349,Vilano=531,Santa_Cruz=0,Balboa=0,Total=1452;
INSERT INTO 06 SET Name='Kyle Holt',Cabo=0,LBI=430,OBX=478,Aliso=0,Dewey=531,Vilano=0,Santa_Cruz=0,Balboa=0,Total=1439;
INSERT INTO 06 SET Name='Dave Armstrong',Cabo=313,LBI=656,OBX=228,Aliso=0,Dewey=0,Vilano=206,Santa_Cruz=0,Balboa=0,Total=1403;
INSERT INTO 06 SET Name='Steve Boomhower',Cabo=0,LBI=0,OBX=387,Aliso=0,Dewey=0,Vilano=1000,Santa_Cruz=0,Balboa=0,Total=1387;
INSERT INTO 06 SET Name='Steve Taylor',Cabo=0,LBI=0,OBX=0,Aliso=219,Dewey=0,Vilano=0,Santa_Cruz=590,Balboa=254,Total=1063;
INSERT INTO 06 SET Name='Austin Bleiweiss',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=478,Vilano=349,Santa_Cruz=0,Balboa=167,Total=994;
INSERT INTO 06 SET Name='Erik Christensen',Cabo=0,LBI=0,OBX=0,Aliso=957,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=957;
INSERT INTO 06 SET Name='Justin Boisclair',Cabo=0,LBI=314,OBX=0,Aliso=0,Dewey=0,Vilano=590,Santa_Cruz=0,Balboa=0,Total=904;
INSERT INTO 06 SET Name='Jonathan Bunn',Cabo=0,LBI=590,OBX=254,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=844;
INSERT INTO 06 SET Name='Jake Stinnett',Cabo=167,LBI=0,OBX=0,Aliso=177,Dewey=0,Vilano=0,Santa_Cruz=314,Balboa=185,Total=843;
INSERT INTO 06 SET Name='Toby Lehman',Cabo=0,LBI=0,OBX=0,Aliso=775,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=775;
INSERT INTO 06 SET Name='Drew Peace',Cabo=478,LBI=0,OBX=0,Aliso=76,Dewey=0,Vilano=0,Santa_Cruz=122,Balboa=98,Total=774;
INSERT INTO 06 SET Name='Jesse Westgaard',Cabo=348,LBI=0,OBX=0,Aliso=412,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=760;
INSERT INTO 06 SET Name='David Scott',Cabo=0,LBI=0,OBX=348,Aliso=94,Dewey=0,Vilano=254,Santa_Cruz=0,Balboa=0,Total=696;
INSERT INTO 06 SET Name='Connor Schmitt',Cabo=0,LBI=349,OBX=0,Aliso=0,Dewey=314,Vilano=0,Santa_Cruz=0,Balboa=0,Total=663;
INSERT INTO 06 SET Name='Hunter Poller',Cabo=150,LBI=0,OBX=0,Aliso=371,Dewey=0,Vilano=0,Santa_Cruz=109,Balboa=0,Total=630;
INSERT INTO 06 SET Name='Miles Grobman',Cabo=0,LBI=0,OBX=0,Aliso=628,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=628;
INSERT INTO 06 SET Name='Jed Currington',Cabo=0,LBI=0,OBX=150,Aliso=0,Dewey=0,Vilano=478,Santa_Cruz=0,Balboa=0,Total=628;
INSERT INTO 06 SET Name='Joey Pasquali',Cabo=0,LBI=0,OBX=0,Aliso=116,Dewey=0,Vilano=0,Santa_Cruz=282,Balboa=206,Total=604;
INSERT INTO 06 SET Name='Tyler Stanaland',Cabo=0,LBI=0,OBX=0,Aliso=565,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=565;
INSERT INTO 06 SET Name='Tony Bianchi',Cabo=0,LBI=282,OBX=205,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=487;
INSERT INTO 06 SET Name='Kyle Olsen',Cabo=282,LBI=0,OBX=0,Aliso=197,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=479;
INSERT INTO 06 SET Name='Mike Hickey',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=478,Total=478;
INSERT INTO 06 SET Name='Watkins Holt',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=430,Vilano=0,Santa_Cruz=0,Balboa=0,Total=430;
INSERT INTO 06 SET Name='Chris Splendore',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=430,Santa_Cruz=0,Balboa=0,Total=430;
INSERT INTO 06 SET Name='Nate Zoller',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=430,Balboa=0,Total=430;
INSERT INTO 06 SET Name='Ben Koscielniak',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=387,Balboa=0,Total=387;
INSERT INTO 06 SET Name='Brad Domke',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=349,Total=349;
INSERT INTO 06 SET Name='Marcos Paranhos',Cabo=0,LBI=0,OBX=166,Aliso=0,Dewey=0,Vilano=150,Santa_Cruz=0,Balboa=0,Total=316;
INSERT INTO 06 SET Name='Jesse Helm',Cabo=0,LBI=0,OBX=0,Aliso=129,Dewey=0,Vilano=0,Santa_Cruz=167,Balboa=0,Total=296;
INSERT INTO 06 SET Name='Keith Peery',Cabo=0,LBI=0,OBX=0,Aliso=85,Dewey=0,Vilano=0,Santa_Cruz=206,Balboa=0,Total=291;
INSERT INTO 06 SET Name='Keith Fanning',Cabo=0,LBI=0,OBX=282,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=282;
INSERT INTO 06 SET Name='Blair Cherico',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=282,Vilano=0,Santa_Cruz=0,Balboa=0,Total=282;
INSERT INTO 06 SET Name='Dion Davis',Cabo=0,LBI=0,OBX=0,Aliso=69,Dewey=0,Vilano=185,Santa_Cruz=0,Balboa=0,Total=254;
INSERT INTO 06 SET Name='Isaac Zoller',Cabo=0,LBI=0,OBX=0,Aliso=243,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=243;
INSERT INTO 06 SET Name='Pete Anderson',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=229,Santa_Cruz=0,Balboa=0,Total=229;
INSERT INTO 06 SET Name='Gary Velo',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=98,Balboa=109,Total=207;
INSERT INTO 06 SET Name='Ryan Parola',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=122,Balboa=80,Total=202;
INSERT INTO 06 SET Name='Chris Alreck',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=185,Balboa=0,Total=185;
INSERT INTO 06 SET Name='Jake Hendry',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=167,Santa_Cruz=0,Balboa=0,Total=167;
INSERT INTO 06 SET Name='Dan McMillian',Cabo=0,LBI=0,OBX=0,Aliso=160,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=160;
INSERT INTO 06 SET Name='John Collins',Cabo=0,LBI=0,OBX=0,Aliso=144,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=144;
INSERT INTO 06 SET Name='Steve Pullara',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=135,Santa_Cruz=0,Balboa=0,Total=135;
INSERT INTO 06 SET Name='Adam Loreo',Cabo=0,LBI=0,OBX=0,Aliso=0,Dewey=0,Vilano=0,Santa_Cruz=135,Balboa=0,Total=135;
INSERT INTO 06 SET Name='Nick Hernandez',Cabo=0,LBI=0,OBX=0,Aliso=105,Dewey=0,Vilano=0,Santa_Cruz=0,Balboa=0,Total=105;



The error that I get (through phpmyadmin) is at the top of the query where it is declaring the different column names. This is the error:

Error

SQL query:

#
# MySQL-Dump created by SQL Database Import Utility, 1.0.44, Host-ID: 3cc14929
# HTTP-Host: www.sqldbu.com
# Date: 2009-08-12 16:17:46
# --------------------------------------------------------
#
#
CREATE TABLE IF NOT EXISTS 06 (
NameCHAR( 16 ) NOT NULL default '',
Cabo DECIMAL( 4, 0 ) NOT NULL ,
LBI DECIMAL( 4, 0 ) NOT NULL ,
OBX DECIMAL( 4, 0 ) NOT NULL ,
Aliso DECIMAL( 4, 0 ) NOT NULL ,
Dewey DECIMAL( 4, 0 ) NOT NULL ,
Vilano DECIMAL( 4, 0 ) NOT NULL ,
Santa_Cruz DECIMAL( 4, 0 ) NOT NULL ,
Balboa DECIMAL( 4, 0 ) NOT NULL ,
Total DECIMAL( 4, 0 ) NOT NULL ,
RECNO INT( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
PRIMARY KEY ( RECNO )
);

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 '06 (Name			  CHAR(16) NOT NULL default '', Cabo DECIMAL(4,0) NOT NULL, ' at line 1 



It looks as if the error is generated by the line
NameCHAR( 16 ) NOT NULL default '',
because of there not being a space. But I put one, two, as well as ten spaces and for some reason it truncates the space every time I enter in the query. Is that not whats wrong? And if it is, how can I fix it?

I just tested with something else (using VARCHAR(255) instead) and it still didn't work, so my original assumption was wrong. It has nothing to do with the space there.

(MySQL server version 5.1.33)

This post has been edited by evinrows: 12 August 2009 - 07:30 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Problem with large database query.

#2 ForcedSterilizationsForAll   User is offline

  • D.I.C Addict

Reputation: 33
  • View blog
  • Posts: 506
  • Joined: 16-July 09

Re: Problem with large database query.

Posted 12 August 2009 - 07:37 AM

Is Name a reserved word? What if you call it something other than name?
Was This Post Helpful? 0
  • +
  • -

#3 evinrows   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 141
  • Joined: 03-August 09

Re: Problem with large database query.

Posted 12 August 2009 - 07:51 AM

Attempted rider_name, same error.
Was This Post Helpful? 0
  • +
  • -

#4 AdaHacker   User is offline

  • Resident Curmudgeon

Reputation: 463
  • View blog
  • Posts: 820
  • Joined: 17-June 08

Re: Problem with large database query.

Posted 12 August 2009 - 08:17 AM

Two things here:

1) You have the field name and type running together on this line: NameCHAR( 16 ) NOT NULL default ''. You need to change that to Name CHAR( 16 ) NOT NULL default ''.

2) You can't specify a table name that's all numeric like that. You need to either use a different name (which I think is cleaner), or always reference the table name in back-quotes, like this: `06`.
Was This Post Helpful? 1
  • +
  • -

#5 evinrows   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 141
  • Joined: 03-August 09

Re: Problem with large database query.

Posted 12 August 2009 - 08:42 AM

Thanks so much Ada, I saw that you were looking at the thread and knew I'd have my solution soon. :]
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1