Write a script to extract information from db tables
Hi
I want to write a script that will extract information from a db table and store that information to a csv file. Basically, I have imported data into a table, I want to save this data to a csv file for later processing. How do I connect to the db and extraxt information from the table? Thank you |
It depends:
1. Which scripts you prefer, Perl, Python or other? 2. What database you are working on, MySQL, SQLite or something else? Export data from database table into csv is not necessary since many script languages provide database interfaces. For instance, the DBI for Perl. |
hmmm ... db ... Mysql, Oracle, DB2 ... and the list goes on
You will need to advise the database you are dealing with (I could assume mysql but long track if i am wrong) and you need to also tell us what you would like to use, ie bash, perl, etc |
use this
For ORACLE Code:
sqlplus username/password@database_name << END Code:
sqlplus username/password@database_name @ abc.sql For MySQL Code:
mysql -u username -p password database -e "Your SQL Commands" |
All times are GMT -5. The time now is 01:44 PM. |