Solved

Wanted: no column headers in output file

Posted on 2007-03-20
8
231 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:Ronny Stijns
  • 4
  • 2
8 Comments
 
LVL 30

Expert Comment

by:SteveGTR
ID: 18755647
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
ID: 18756094
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:Ronny Stijns
ID: 18785280
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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 30

Expert Comment

by:SteveGTR
ID: 18789048
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:Ronny Stijns
ID: 18822326
Thanks Steve for the solution.
It must be -h-1 instead of -h.

0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 18822776
Yes, that will do the trick.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 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