Link to home
Start Free TrialLog in
Avatar of Ronny Stijns
Ronny Stijns

asked on

Wanted: no column headers in output file

I'm using MSSQL 2000 osql to run scripts against databases for monitoring purpose.
The output of the script is saved into an output file.

I would llike to get rid of the column headers in the output file.
So instead of

Column A  Column B
-----------   -----------
a                1

I would like to get
a       1

What parameter of option can i use either with osql or within the t-sql script?
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

You could do this:

@echo off

setlocal

set oldFile=output.txt
set newFile=newFile.txt

del "%newFile%" 2>NUL

for /f "tokens=* skip=2" %%a in ('type "%oldFile%"') do (echo %%a)>>"%newFile%"

echo Output in "%newFile%"

Good Luck,
Steve
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ronny Stijns
Ronny Stijns

ASKER

I tried the -h options, but it still gave me headers in the outputfile.
I'll try the answer Steve gave.

To be continued.
The -h work for me as did my manual batch file processing. Maked sure not specify the parameter exactly:

-h-1

No spaces in between characters for this parameter.
Thanks Steve for the solution.
It must be -h-1 instead of -h.

Yes, that will do the trick.