Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CLP redirect output to a delimited file

Status
Not open for further replies.

infdeveloper

Programmer
Feb 23, 2005
4
US
Hello,

I am trying to solve a problem to redirect output from a sql command to a delimited file

I am doing

db2 connect to $database user $username using $password
db2 select * from x > file.out
db2 terminate

Export gives the choise but, I can use export as I dont have privilages,and it creates the file in db server for which i dont have permissions

I am struggling to get an option that allows me to write to a delimited file(file.out). The default is it is writing in a fixed width flat file

Could any of you please help me in this

any help is greatly appreciated

Thanks
 
You could try delimiting it yourself in the query:

SELECT COL1, ',', COL2, ',', etc FROM X > file.out

Marc
 
>> [Export gives the choise but, I can use export as I dont have privilages,and it creates the file in db server for which i dont have permissions ]

If you do have the privileges to use EXPORT, you should be able to export the data to a delimited file which does NOT have to be created on the server.
EXPORT TO "path\filename.dat" OF DEL MODIFIED BY CHARDEL'' COLDEL, MESSAGES "path\filename.LOG" SELECT * FROM table_name

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top