Reputation: 21
I have complex SQL Query and I want to export data (csv files) with these SQL via db2 commandline and must include these format "xxxxx","aaaaaa","cccccccc"
sql query I save in .sql file
what's command?
Upvotes: 1
Views: 5120
Reputation: 7693
If you want to export data from DB2, you need to use the 'export' command. For example, for a table called employees you will execute
db2 "export to myFileName.csv of DEL select * from employee"
If you need to include strings in you query, you can put single quotes around the word.
In order to execute this, you need a DB2 client, invoke the db2clp, and be connected to the database.
In windows: Run
db2cmd
db2 connect to sample
For more information, please consult the InfoCenter: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0008303.html
Upvotes: 2