473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

LOAD DATA INFILE problem

seshu
156 100+
Hi Everybody
this is seshu here i have doubt
I have a piece of code to insert data into table which is there in a txt file
and this is the code
LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;
now is it possible load data from a excel file if so how i tried this but this is not working
some one help me out
regards
seshu
Jan 30 '07 #1
8 3557
ronverdonk
4,258 Expert 4TB
You have 2 different question in the same thread. Therefore I have split this thread.

moderator
Jan 30 '07 #2
ronverdonk
4,258 Expert 4TB
You'd have to provide more information. A statement like 'it does not work' is not enough to investigate.

So show your text data structure, your table structure and your SQL statement, and when you do: put the code within code or php tags!

Ronald :cool:
Jan 30 '07 #3
seshu
156 100+
NO NO What the query i gave there is very much correct it should be filled with table name and the text file which is to be imported into
Feb 3 '07 #4
ronverdonk
4,258 Expert 4TB
What NO NO? I didn't say your query is incorrect, I only want to see the table defs and some excel data involved. You want the answer, you provide the means.

Ronald :cool:
Feb 3 '07 #5
subash
33
Hi Seshu - provide some example data contains atleast 5 records and the table structure - so that we can easily answer the question

Subash :)
Feb 5 '07 #6
seshu
156 100+
ok sir here is the data
of my excell table ny excel sheet contains 5 columns
column 1 name
column 2 age
column 3 fateher name
column 3 mother name
column 4 maternal status
now in my back end also there is a simmilar table with 5 columns
column 1 name --daatype varchar
column 2 age--daatype varchar
column 3 fateher name--daatype varchar
column 3 mother name--daatype varchar
column 4 maternal status --daatype varchar
now how to export these 5 columns of excell sheet to mysql datbase,table
and the code i have is LOAD DATA LOCAL INFILE 'sehsu.xls' INTO table userdetails;
regards
seshu
Feb 7 '07 #7
I think LOAD DATA command can import only text files, at least up to MySQL4.17.
Even the extension of the file has to be .txt

I once tried to import a text file with extension .dat, the load failed.

So may be you will have to generate a text file, and use an appropriate field separator from the excel file before importing.
Feb 8 '07 #8
seshu
156 100+
ok then i will import only the text file but the problem in importing the text file is in my table the last column is status there in status after the word i am able see a small box and these boxes are because of the enter key after every line in my text file and these boxes are seen only in last column so the reason i have concluded so
i think iam clear if not i dont mine explaining again but i would like to know the solution
regards
seshu
Feb 13 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Bruce A. Julseth | last post by:
When I execute this SQL statement in my PHP code, I get an error "File '.\Address.txt' not found (Errcode: 2)" $File = addslashes(".\Address.txt"); $SQL = "Load Data InFile \"" . $File . "\"...
3
by: Otto | last post by:
Hello to all I have a problem how to write correctly a PHP string. I did the following import with the help of PHPMyAdmin: Nombre d'enregistrements insérés : 364 (traitement: 0.0553 sec.)...
3
by: hall | last post by:
I have a problem with my design of a templatized class. I'm trying to figure out how to load and save the data inside it, but can't. My class looks like this ------------------------------------...
0
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to...
1
by: Jami Bradley | last post by:
HI all, For the past several months we have been using LOAD DATA LOCAL INFILE to bulk load tables within Perl modules. Recently, someone thought it would be a good idea to upgrade the Solaris...
0
by: Rajesh Kapur | last post by:
Hello, I am running MySQL 4.0.16. I get the error 'The used command is not allowed with this MySQL version' when using the 'load data local infile' command. The local_infile is ON; the select *...
2
by: Alex Hunsley | last post by:
I'm using a mysql monitor under cygwin (on win xp) to do a 'load data infile' to put some data into a mysql database (I'm using the xampp bundle).. My problem is that I have a four line CSV file...
1
by: Ray in HK | last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE ? I found some web hosting company do not allow using LOAD DATA INFILE but allow LOAD DATA LOCAL INFILE. The reason...
5
by: Justin | last post by:
Hi, im facing a problem here. First of all here is my program requirement. I got a .csv file with thousands of records inside, i need to import them into my mysql database. So i tried using load...
0
by: lanesbalik | last post by:
hi all, right now i'm trying to migrate from db2 running under linux to mysql v5.1. i manage to export out the db2 structure & data into a del (ascii) file. but when i try to load the data...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.