cancel
Showing results for 
Search instead for 
Did you mean: 

vb6 select output to text filename

Former Member
4,281

First, am in the correct users group?

I have code in vb6, ADODB and SAOLEDB connections,

select statement ; output to filename.txt format ascii

this is the code that works in ISQL, and will work in vb with OUT the "output to filename" but when the output to is there I get this error: Syntax error near 'OUTPUT' online 1.

Here is the code:

All help appreciated. thanks

sqlTM = "SELECT CUSTOMER.NAME,CUSTOMER.CUCD, CUSTOMER.APAR,ADDRESS1,ADDRESS2,CITY,STATE,
  ZIP,EMAIL,HINVOICE.INVOICE,HINVOICE.NOTAXABLE,
  HINVOICE.TAXABLE,INVDATE, CAST(sum(HINVOICE.NOTAXABLE + HINVOICE.TAXABLE) AS CHAR) INVTOTAL  
FROM HINVOICE JOIN CUSTOMER ON HINVOICE.CUCD = CUSTOMER.CUCD  
WHERE CUSTOMER.EMail Like '" & EMail & "' 
  AND CUSTOMER.APAR LIKE 'AR' AND (HINVOICE.INVDATE  >= '" & StartDate & "' AND HINVOICE.INVDATE < '" & Enddate & "') and " ((HINVOICE.NOTAXABLE  > '" & LowDollars & "' and HINVOICE.TAXABLE  > '" & LowDollars & "') and (HINVOICE.TAXABLE  < '" & HighDollars & "' and HINVOICE.TAXABLE  < '" & HighDollars & "'))" " 
GROUP BY HINVOICE.CUCD,INVOICE,OTAXABLE,HINVOICE.TAXABLE,NAME,ADDRESS1,ADDRESS2,CITY,STATE,
  ZIP,EMAIL,INVDATE,CUSTOMER.APAR,CUSTOMER.CUCD;
OUTPUT TO 'C:\\EmailList.txt'"

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

OUTPUT is an ISQL statement, it is not a SQL statement supported by the server.

You can use the UNLOAD SELECT statement to output the result set of a SELECT statement into a flat file.

Former Member
0 Kudos

Yah, I just found it about 5 minutes ago, it does close the record set before I can get a count, but I can live with out that....

thanks so much, the number of hours I have in to this is SHAMEFULL!!!!

thanks again.

just an fyi, it does work with the case, groupby, etc,

Former Member
0 Kudos

Here is what I use for a global env. gblADOProvider = "SAOLEDB" & " ;Data Source=AutoTireTech" & " ;User = EXT ; Password = ext"

I would love to see a sample of how to connect with out the ODBC Data Source and to set the dbengine in quiet mode (no displays)

Am I asking too much?

Former Member
0 Kudos

Is there an easy way to turn off the banner that comes up when doing the unload ? It is the banner of the db engine starting. I do not have a daemon or service running.

I was looking to do a "shell" command to either start it or some how turn off the banner.

Any suggestions?

thanks again

Former Member
0 Kudos

Look in the help under "quiet mode".

Operating quietly The database server supports quiet mode. You determine how quiet you want the server to operate, ranging from suppressing messages or the icon in the system tray, to complete silence. To operate a completely silent database server on Windows, specify the -qi, -qs, and -qw options. With these options set, there is no visual indication that the server is running as all icons and all possible startup error messages are suppressed. If you run the database server in quiet mode, you can use either (or both) the -o or -oe options to diagnose errors.

The -qi and -qs options do not suppress windows caused by the -v (version) and -ep (prompt for database encryption password) server options. See:

-qi dbeng12/dbsrv12 server option -qn dbeng12/dbsrv12 server option -qs dbeng12/dbsrv12 server option -qw dbeng12/dbsrv12 server option

Former Member
0 Kudos

I have done the options, but one at a time.. thanks so much. I just did not conclude they were all needed at once.

Live and learn thanks