SunQuest
           MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old July 11th, 2000, 10:11 AM
craig34's Avatar
craig34 craig34 is offline
Webmaster Extraordinaire
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Location: Woburn, MA
Posts: 126 craig34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 39 sec
Reputation Power: 9
I need some serious help and fast. My Web Design company took on a job, that we assumed we knew how to do, only it turns out that I have had some big problems importing data into MySQL. The client has sent me the text files, but I can't get them to go into my database. This is what I am using:

LOAD DATA INFILE 'new_contacts.txt' REPLACE INTO TABLE GTContac FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY 'n'

It loads the file fine, but for some reason, the table ends up with only one entry. That entry is basically fine with the exception of the first field, which gets cut off for some reason. ALso, the last field retains its quotation marks for some reason. An example of the entries in the text file can be found below:

"16103","Bridget","Salantri","Hist Horticulturist","Friends of Washington Crossing Historic Park","215 493 4076","(215)493-4820","fishy@ptd.net","Friends of Washington Crossing Historic Park","PA Hist & Museum Comm, 1112 River Rd","Washington Crossing","PA","18977","USA"

The listing of what each field is, just in case it might be helpful is below.

recno - tinyint(6)
first - varchar(40)
last - varchar(40)
title - varchar(40)
dept - varchar(40)
combtel - varchar(20)
combfax - varchar(20)
combemail - varchar(60)
ctcmlgorg - varchar(60)
ctcmlgadd - varchar(60)
ctcmlgcity - varchar(40)
ctcmlgst - varchar(15)
ctcmlgzip - varchar(15)
ctcmlgctry - varchar(30)


I would really appreciate any help that anyone could provide. If you need more information let me know. Feel free to email me as well.

Craig Anderson
canderson@intrepidwsd.com

Reply With Quote
  #2  
Old July 11th, 2000, 12:39 PM
craig34's Avatar
craig34 craig34 is offline
Webmaster Extraordinaire
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Location: Woburn, MA
Posts: 126 craig34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 39 sec
Reputation Power: 9
One more thing that I forgot to add. I have gone through the MySQL reference, etc, but none of that is helping me so far.

Reply With Quote
  #3  
Old July 11th, 2000, 12:49 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
I can't help you with why the quotes aren't coming off the last field, but the reason the first field is dropped is because you've defined the first field as a TINYINT which can hold the values of -128 thru 127 (or, if declared UNSIGNED, 0 thru 255) and the data you are trying to input is outside of that range.

The possible reason the quotes aren't dropping may be related to the reason you are only getting one record. The line may be terminated by a carriage return as well as the new line. (/r/n)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Problem with Importing Data into MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway