I am a relative DB2 novice and I am experiencing some problems outputting query results to a delimited file. The query set I am returning includes 15+ attributes and approximately 20,000 records. After reading up on the DB2 documentation I tried to use the EXPORT session functionality from a command prompt via:
db2 export to filename.del of del .... select ...
however my select statement is far to long.
The second method would be to follow a successful method I've been using for smaller queries. An example would be:
db2 +o -tvf filename.sql -r filenameoutput
Unfortunately this format doesn't easily display output files with many attributes:
I would greatly appreciate if someone knows a way via a command prompt to:
1.Read in an .sql file
2.Output the query result set to a delimited file
How long is too long? Obviously, it does not exceed the DB2 sql statement size limit since you are able to execute it from a file...
Therefore, I assume you're hitting the OS command line length limit. There's nothing that prevents you from putting the entire EXPORT command into a script file and executing it the same way you do it with your SELECT statement...