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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to ASCII file in SQL statement

Status
Not open for further replies.

stuartd

Programmer
Jan 8, 2001
146
US
I am trying to export a table to an ASCII file in Stored procedure using Informix 7.24 on UNIX box.

I found 'OUTPUT TO {file} SELECT statement' and 'UNLOAD TO {file} SELECT statement' on but these both give me errors.

Any ideas?
 
Which Error message is it?
I would use the following command:
UNLOAD TO "file_name.unl" SELECT * FROM your_table_name;
Make sure you have rights to write in the directory you are unloading this file to.!
 
Thanks for reply.

I have since found out that UNLOAD is not a SPL statement, so i have resolved the problem another way.
 
Kindly try this after connecting to the database

You can mention all the fields in select command of the sql and redirect the output to a file , in the select command you need to seperate the fields by comma and even can add a delimiter after each field as

select name,"|",age,"|" from emp_mast;

Mail me any problem you have using informix at sonarrajesh@hotmail.com

-Rajesh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top