1

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?

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.