Read TABLE and write in TXT file

Hi,
I want to read the values from a table in ASA9 and want them in TXT file format delimted by tab.I use PB10.

(I can use SELECT n OUTPUT stt in ISQL and do the same, but it seems I cannot write TXT file using Stored Proc.)

Any idea ?
Thanks
M
mahalakshmi_sAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

buasuwanCommented:
Hi,
   
   The simplest way to export your data to text file is creating a datawindow object, call retrieve() and then saveas().  And here is the codes.


datastore   lds_obj

lds_obj = create datastore
lds_obj.dataobject = "d_your_datawindow_object"  // SELECT n OUTPUT stt
lds_obj.SetTransObject(sqlca)

lds_obj.Retrieve()
lds_obj.SaveAs("your_text_file.txt", Text!, false)


Hope this help,

Buasuwan

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sandeep_patelCommented:
Hi,

It depends on whether you want to write a programme in powerbuilder or just want to export data of any table from back end.

1) For powerbuilder...solution given by Buasuwan

2) to export data from back end...see help for Unload table command

UNLOAD [ FROM ] TABLE [ owner. ]table-name TO filename
[ unload-option . . . ]
unload-option :
APPEND{ON | OFF}
| DELIMITED BY string
| ESCAPE CHARACTER character
| ESCAPES {ON | OFF}
| FORMAT {ASCII | BCP}
| HEXADECIMAL {ON | OFF}
| ORDER {ON | OFF}
| QUOTES {ON | OFF}
filename : { string | variable }

Regards,
Sandeep
mahalakshmi_sAuthor Commented:
Sandeep,
This UNLOAD is not working inside StoredProc ,only from ISQL :-((((((
will work onBuasuwan's option now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.