Thursday, March 8, 2012

control over select output results

Hi All !

Is it possible to get rid of these dash symbols which are underlining
the column name when recordset is returned after query execution ?

For example, using isql.exe:

SELECT 'blah'
go

produces the following results:

--
blah

What I want to achieve is just
blah

I know that SET NOCOUNT ON switches the "X row affected" thing. But
how about column headers ?

Thanks for your time,

SeekerHi

I don't think there is a way to stop the dashed lines, although you could
send the output to a file and strip it out with findstr. To get rid of the
column headers (and lines) remove the check box for "print headers" in
tools/options/results or specify -h-1 when using isql or osql.

John
"." <seeker12@.subdimension.com> wrote in message
news:24693db3.0309012131.7cd01fe0@.posting.google.c om...
> Hi All !
> Is it possible to get rid of these dash symbols which are underlining
> the column name when recordset is returned after query execution ?
> For example, using isql.exe:
> SELECT 'blah'
> go
> produces the following results:
> --
> blah
> What I want to achieve is just
> blah
> I know that SET NOCOUNT ON switches the "X row affected" thing. But
> how about column headers ?
> Thanks for your time,
>
> Seeker|||seeker12@.subdimension.com (.) wrote in message news:<24693db3.0309012131.7cd01fe0@.posting.google.com>...
> Hi All !
> Is it possible to get rid of these dash symbols which are underlining
> the column name when recordset is returned after query execution ?
> For example, using isql.exe:
> SELECT 'blah'
> go
> produces the following results:
> --
> blah
> What I want to achieve is just
> blah
> I know that SET NOCOUNT ON switches the "X row affected" thing. But
> how about column headers ?
> Thanks for your time,
>
> Seeker

There is no way to remove this in an interactive session, as far as
I'm aware. If you're running from a script, you could parse the output
and remove the dashes, though.

Simon|||[posted and mailed, please reply in news]

.. (seeker12@.subdimension.com) writes:
> Is it possible to get rid of these dash symbols which are underlining
> the column name when recordset is returned after query execution ?
> For example, using isql.exe:
> SELECT 'blah'
> go
> produces the following results:
> --
> blah
> What I want to achieve is just
> blah

With ISQL and OSQL you can use -h-1 to turn off headers.

In Query Analyzer you can under Tools->Options->Results change results
to text, and select something else than column delimited.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Hi

There could be a cludge!

Use -h-1 or remove the print headers and do a union. That forces the column
headers as the first row retrieved. You will need a method to sort the
results which probably makes it as bad as having the underlines themselves!

select 'pub_id' as pub_id, 'pub_name' as pub_name, 0 as ' '
union all
select CONVERT(varchar,pub_id), pub_name, 1 from publishers
order by 3

John

"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:3f544438$0$249$ed9e5944@.reading.news.pipex.ne t...
> Hi
> I don't think there is a way to stop the dashed lines, although you could
> send the output to a file and strip it out with findstr. To get rid of the
> column headers (and lines) remove the check box for "print headers" in
> tools/options/results or specify -h-1 when using isql or osql.
> John
> "." <seeker12@.subdimension.com> wrote in message
> news:24693db3.0309012131.7cd01fe0@.posting.google.c om...
> > Hi All !
> > Is it possible to get rid of these dash symbols which are underlining
> > the column name when recordset is returned after query execution ?
> > For example, using isql.exe:
> > SELECT 'blah'
> > go
> > produces the following results:
> > --
> > blah
> > What I want to achieve is just
> > blah
> > I know that SET NOCOUNT ON switches the "X row affected" thing. But
> > how about column headers ?
> > Thanks for your time,
> > Seeker|||Thanks a heap to everyone who replied !

The -h-1 option is exactly what I was after.

What would we do without USENET !

Have fun!

Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns93EAE80C9CB44Yazorman@.127.0.0.1>...
> [posted and mailed, please reply in news]
> . (seeker12@.subdimension.com) writes:
> > Is it possible to get rid of these dash symbols which are underlining
> > the column name when recordset is returned after query execution ?
> > For example, using isql.exe:
> > SELECT 'blah'
> > go
> > produces the following results:
> > --
> > blah
> > What I want to achieve is just
> > blah
> With ISQL and OSQL you can use -h-1 to turn off headers.
> In Query Analyzer you can under Tools->Options->Results change results
> to text, and select something else than column delimited.

No comments:

Post a Comment