Results 1 to 5 of 5

Thread: Export records to text file through SQL query

  1. #1
    Member
    Join Date
    Feb 99
    Location
    dubai
    Posts
    39

    Export records to text file through SQL query

    Hi,


    Does anyone know how to export a table to a text file through a SQL query?
    ganraj.

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 02
    Posts
    1,313
    What database are you using?

  3. #3
    Member
    Join Date
    Feb 99
    Location
    dubai
    Posts
    39
    Microsoft Access 2000 with ADO 2.6 through VB 6.0
    ganraj.

  4. #4
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 02
    Posts
    1,313
    You could use Access' built-in Export functionality - you'll need to add an Access object to your code and use Automation.

    Or if XML is acceptable, you could look at the Save method of the recordset:
    VB Code:
    1. rst.Save "c:\myfile.xml", adPersistXML

    Or, finally, you'll have to code it, looping through the recordset and writing to the file. This will be the most hard work, but will also give you greatest control...
    Last edited by PilgrimPete; Jan 6th, 2003 at 03:41 AM.

  5. #5
    Member
    Join Date
    Feb 99
    Location
    dubai
    Posts
    39
    I am looking for a query something like this to run in ADO:

    db.Execute "SELECT * INTO [Text;database=c:\testdata]. HEADER0.txt from mytable"

    The above query runs in DAO but not is ADO.


    Any Help?
    ganraj.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •