Solved

Wanted: no column headers in output file

Posted on 2007-03-20
8
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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 how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

623 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