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
Solved

Wanted: no column headers in output file

Posted on 2007-03-20
8
230 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
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:rbijl
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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:rbijl
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

808 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