Is there any way by which we can export the result of a select statment to CSV file, just like in MySQL.
MySQL Command;
SELECT col1,col2,coln into OUTFILE 'result.csv'
FIELDS TERMINATED BY ',' FROM testtable t;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can run this command from the DB2 command line processor (CLP) or from inside a SQL application by calling the
ADMIN_CMDstored procedureThere are lots of options for
IMPORTandEXPORTthat you can use to create a data file that meets your needs. TheNOCHARDELqualifier will suppress double quote characters that would otherwise appear around each character column.Keep in mind that any
SELECTstatement can be used as the source for your export, including joins or even recursive SQL. The export utility will also honor the sort order if you specify anORDER BYin yourSELECTstatement.