Solved

Wanted: no column headers in output file

Posted on 2007-03-20
8
226 Views
Last Modified: 2010-04-16
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?
0
Comment
Question by:rbijl
  • 4
  • 2
8 Comments
 
LVL 30

Expert Comment

by:SteveGTR
Comment Utility
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
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 125 total points
Comment Utility
Looks like you can use the -h parameter to do this task:

osql -h-1 -S . -d northwind -E -Q "select top 5 * from orders"
0
 
LVL 1

Author Comment

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

To be continued.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 30

Expert Comment

by:SteveGTR
Comment Utility
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.
0
 
LVL 1

Author Comment

by:rbijl
Comment Utility
Thanks Steve for the solution.
It must be -h-1 instead of -h.

0
 
LVL 30

Expert Comment

by:SteveGTR
Comment Utility
Yes, that will do the trick.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now