[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Read TABLE and write in TXT file

Posted on 2006-04-10
3
Medium Priority
?
1,076 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:mahalakshmi_s
3 Comments
 
LVL 5

Accepted Solution

by:
buasuwan earned 2000 total points
ID: 16418781
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
0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 16423738
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
0
 

Author Comment

by:mahalakshmi_s
ID: 16426307
Sandeep,
This UNLOAD is not working inside StoredProc ,only from ISQL :-((((((
will work onBuasuwan's option now.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deletiā€¦
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question