is it possible to export/import data using fix-width and not the csv or tab dilimited format? if not, has anyone had successfully created a utility for it?
i tried to use the statement 'SELECT...INTO OUTFILE' to export data from mysql to a text file and use 'LOAD DATA INFILE' to import data from text file to mysql. I don't have a problem with this for as long as i used the same delimiter when i do the export/import process.
Now, we have an existing database (C-ISAM on AIX 4.2, with Magic Software as the front-end) which i need to import into it the data from mysql. The problem is, the built-in export/import utility from Magic accepts only fix-width format while in contrary, i could not generate an output from the 'SELECT...INTO OUTFILE' statement WITHOUT using a delimiter! Or, is there a way for this that i didn't just discover?
Here's my plan:
1. I'll do the export from mysql using 'SELECT...INTO OUTFILE' using a comma or tab delimiter.
2. Create a utility (in PHP) that would remove the delimiters from the output file created in step1.
3. Import the edited output file from step 2 into our existing database using Magic.
sleipner, i hope you could share to me the algorithm you used or better yet, a sample code snippet in removing the delimiters.
if you have better suggestions, pls share it with me.
I just used mysqldump. Seems to work great, though I have not tried the restore.
We would rather use select * into outfile....... as the companion to load data local infile. However, while the load data local infile.... works great, there is not a 'local' option for select * into outfile... and I get a permission denied using password (no). Our server is Linux and we are connection using putty from NT. Do I have to move to the server to execute select * into outfile...?
Do you mean that you want to save the file onto another server? If this is the case, you can't use SELECT..INTO OUTFILE, use mysqldump instead or mysql -e "SELECT..."> outfile to generate the file.
SELECT...INTO OUTFILE is mainly intended to let you dump very quickly a table into the host server. Check the manual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.