Quote:
|
Originally Posted by felx
How to write 'select col2,',',col3,','col4 from table1 ' to a csv? From CLP?
|
Hi,
I don't like CLP because there is not possible of using operating system commands (or is more difficult). So I use Command Window.
You can use:
db2 -r output_file.txt -tf sql_file.sql
or you can also use operating system command "redirect to file" which is letter >.
db2 -tf sql_file.sql > output_file.txt
Note: On Windows "redirect to file" returns one additional character at the end of file. I suggest you to look into output_file with some hex-text tool to see the output.
-r option appends data to output_file so you need to delete the output if you like to rerun the sql_file.
Hope this helps,
Grofaty