|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
In which directory does the INFILE have to be placed?
|
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > How to import a multiple rows into table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|