Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 01-16-2005, 02:36 AM   PM User | #1
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 1,890
Thanks: 5
Thanked 22 Times in 18 Posts
chump2877 is on a distinguished road
Error received when trying to upload SQL code with phpMyAdmin

Here's my situation:

I've got a .csv file that I created with Excel...I noticed that when I opened up this file in a text editor, that there were lots of trailing commas on subsequent lines following the actual data...I cleaned up the file by deleting these commas, and resaved the file as .csv in my text editor....Then, I used a conversion tool that I found (you can see it HERE) to convert the .csv file to core SQL (i know the conversion tool works because I've used it before)...Now, I'm trying to upload the resulting text file with SQL code to my server using phpMyAdmin...I feel like I've done everything right so far, but I keep getting this error from phpMyAdmin when I try to upload the SQL code:

Quote:
Error

SQL-query :

CREATE TABLE IF NOT EXISTS parts2(

AC0020 CHAR( 10 ) NOT NULL default '',
Microphone_Headset CHAR( 53 ) NOT NULL default '',
5.35CHAR( 42 ) NOT NULL default '',
RECNO INT( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
PRIMARY KEY ( RECNO )
)

MySQL said:


#1064 - You have an error in your SQL syntax near '5.35 CHAR(42) NOT NULL default '', RECNO INT(10) unsigned NOT NULL auto_incremen' at line 1
I believe the syntax should be correct and there should be no typos, but the error seems to indicate otherwise....I'm really at a loss here...I'd include the SQL code, but the file is too large to post here....I can email it to someone if they cared enough to take a look at it....

Thanks in advance for any help you can provide with this one!!
__________________
Regards, R.J.

Media Moguls
Cleveland, Ohio Web Site Design and Application Development
chump2877 is offline   Reply With Quote
Old 01-16-2005, 05:21 AM   PM User | #2
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 1,890
Thanks: 5
Thanked 22 Times in 18 Posts
chump2877 is on a distinguished road
Bottom line, if anyone could point me towards a free SQL debugging utility, I would be very, very grateful !!!!!

__________________
Regards, R.J.

Media Moguls
Cleveland, Ohio Web Site Design and Application Development
chump2877 is offline   Reply With Quote
Old 01-16-2005, 07:10 PM   PM User | #3
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf is on a distinguished road
euh ...

5.35CHAR( 42 ) NOT NULL default '',

should be something else. in any case, you need a space between columname and columntype, so

5.35 CHAR( 42 ) NOT NULL default '',

but 5.35 is not realy a good variablename. and it should be enclosed in backticks --> `5.35`

so working code would be:
Code:
CREATE TABLE IF NOT EXISTS parts2(

AC0020 CHAR( 10 ) NOT NULL default '',
Microphone_Headset CHAR( 53 ) NOT NULL default '',
`5.35` CHAR( 42 ) NOT NULL default '',
RECNO INT( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
PRIMARY KEY ( RECNO )
)
using my psychic powers, i would say that the code you used to convert the csv into a dumpfile, expects a csv file where the first line contains the tableheader --> the columnnames, whereas your csv only contains the data...
__________________
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
raf is offline   Reply With Quote
Old 01-16-2005, 10:47 PM   PM User | #4
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 1,890
Thanks: 5
Thanked 22 Times in 18 Posts
chump2877 is on a distinguished road
Thanks, you were absolutely correct...I guess I don't know my SQL errors as well as I thought....
__________________
Regards, R.J.

Media Moguls
Cleveland, Ohio Web Site Design and Application Development
chump2877 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:03 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.