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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 27th, 1999, 10:44 PM
kumars
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
How can I import a multiple rows of data into a table using a single INSERT statement.
Now I have to use INSERT statement for each row, which I want to make simple by one INSERT statement.

Any help is appreciated.

Reply With Quote
  #2  
Old August 28th, 1999, 08:09 AM
kumars
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Iam answering to my own question it is

LOAD DATA INFILE 'my.data' INTO TABLE myitems;

Detail: I typed all the data into a Gnumeric Spread sheet and saved it as a SIMPLE TEXT FORMAT and named the file my.data.

Then using vi edit the my.data file and remove the first line 'sheet 0' (I need to
find a way to automate this).

Then loged into mySQL usig id and password:
mysql -u root -p
password:*******

then use the database:
mysql> use mydatabase;

then do this to import the text file
LOAD DATA INFILE 'my.data' INTO TABLE items;

bingo, I get couple of warnigns but confirmed the data has added properly as i needed.

You can visit my demo database at
<A href="http://pricelane.tzo.com">PriceL@ne.com</A> and then follow the PriceL@ane Link.

Reply With Quote
  #3  
Old June 6th, 2000, 11:52 PM
smr smr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 1 smr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
In which directory does the INFILE have to be placed?

Reply With Quote
  #4  
Old June 7th, 2000, 11:45 AM
kumars kumars is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Posts: 9 kumars User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
INFILE is part of the syntax.
my.data is the file name.
my.data can be placed anywhere but include the relative path if it is not in the place from where u had started the MySQL.

Hope this helps.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > How to import a multiple rows into table


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 2 hosted by Hostway