Re: SQL to file

From: Cindy Winegarden (
Date: 05/05/04

Date: Wed, 5 May 2004 16:16:47 -0400

In news: OB3z7PrMEHA.936@TK2MSFTNGP11.phx.gbl,
Mike Hunt <> wrote:
> SELECT field1, field2, field3 FROM mytable TO FILE myfile NOCONSOLE
> The problem is it is leaving first two lines in "myfile.txt" ...
> I don't want any empty lines to be left,

Hi Mike,

The following should get you started:

Create Cursor Test (Field1 C(10), Field2 C(10), Field3 C(10))
Insert Into Test Values ("Tom", "Dick", "Harry")
Insert Into Test Values ("Hewey", "Dewey", "Louie")

    Field1, ;
    Field2, ;
    Field3 ;
    Test ;
To File C:\TestFile.txt NoConsole Plain

StrToFile(Substr(FileToStr("C:\TestFile.txt"), 5), "C:\TestFile.txt")
Modify File C:\TestFile.txt

- or -

Copy To C:\TestFile2.txt Type SDF

Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP