Writing SQL results to a .txt

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
tnhall
Newbie
Posts: 5
Joined: Thu Apr 05, 2018 5:34 pm

Writing SQL results to a .txt

Post by tnhall » Thu Apr 05, 2018 5:42 pm

I am new to the macro scheduler world.
Is it possible to write MS Access query results to a .txt?
Also, please validate the connection string. I am trying to connect to MS Access 1997 database. What I have isn't working.
Let> str=oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _ "Dbq=C:\Program Files (x86)\TapWatch2\Databases\TWMain.mdb;"
DBConnect>str,dbH

Let>SQL= SELECT "C:\Program Files (x86)\TapWatch2\Files" & Propertyidentifier & "\" & Propertyidentifier & " Auto Download.lnk" AS Expr1
FROM SiteInformation;
DBExecute>dbH,SQL,result

DBClose>dbH

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Writing SQL results to a .txt

Post by JRL » Fri Apr 06, 2018 3:30 am

Try looking here for a workable connection string.

HERE is Marcus' spectacular SQLtoCSV script.

tnhall
Newbie
Posts: 5
Joined: Thu Apr 05, 2018 5:34 pm

Re: Writing SQL results to a .txt

Post by tnhall » Fri Apr 06, 2018 8:29 pm

JRL wrote:
Fri Apr 06, 2018 3:30 am
Try looking here for a workable connection string.

HERE is Marcus' spectacular SQLtoCSV script.
Exactly what I was looking for. Thank you, JRL!

troytubbs
Newbie
Posts: 1
Joined: Sat Jul 14, 2018 9:57 pm

Re: Writing SQL results to a .txt

Post by troytubbs » Sat Jul 14, 2018 9:59 pm

I am also a newbie in this, and I'll be thankful if someone could describe this process.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts