|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Is it possible to transfer flat file to MySQL database?
I have some flat file like this: name::lname::address::email::comment And I would like to transfer it all to MySQL since file has grown to 8 MB Do you now for any script that does all the job? Thanks |
|
#2
|
|||
|
|||
|
You could use the mysqlimport utility to read in a flat file. Using one of the options to the import utility, you can specify a string that delimits your fields:
mysqlimport -u user -ppassword --fields-terminated-by='::' dbname flatfile.txt Or you could write a quick perl script that dumps your flatfile into INSERT statements, then feed that file into the mysql utility with the stdin redirect: mysql -u user -ppassword dbname < sqlstuff.txt You have to make sure that the database exists in MySQL before you use either of those methods. If you use the INSERT statement file, you could define your database before the INSERT statements. Don [This message has been edited by donarb (edited June 02, 2000).] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Flat file database to MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|