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!

copy a programs results to a text file

Status
Not open for further replies.

PremiumL

MIS
Nov 3, 2004
10
US
I have a program that runs a state count for a database called mail.dbf. This is the program:

SELECT STATE, COUNT(STATE) AS HOWMANY;
FROM MAIL.DBF;
GROUP BY STATE;
ORDER BY STATE;

How can I copy the results to a text file?

Thanks for your help,

Jarrett
 
You can direct your query results right into ASCII text file by including TO FILE clause.

According to VFP Help for SELECT-SQL,

Code:
...
TO FILE FileName

If you include a TO clause but not an INTO clause, you can direct query results to an ASCII text file named FileName, to the printer, or to the main Visual FoxPro window.
...

Or, if you wish, you can select your results INTO TABLE (INTO DBF) or INTO CURSOR, for further use in your program, and then use COPY TO command to send the results into delimited or fixed-width file.

There are other options available for this task as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top