Let me describe something I do with Oracle SQLPlus and want to be able
to get isql to do. I have asked everyone I know, and the best answer
I've received so far is to use unix sed...
In oracle I can write a sql statement like this
SET HEADING OFF
SET FEEDBACK OFF
SELECT * from sample;
When this returns, there are no column headers or a statement at the
bottom of the data telling me how many rows were returned.
Can isql do something like this? If so, please tell me how, and where
the information of this form of control along with others is documented.
Thanks in advance,
George Kerber
USWEST
== In oracle I can write a sql statement like this
==
== SET HEADING OFF
== SET FEEDBACK OFF
== SELECT * from sample;
==
== When this returns, there are no column headers or a statement at the
== bottom of the data telling me how many rows were returned.
to turn off the rowcount:
set nocount on
(see also http://reality.sgi.com/pablo/Sybase_FAQ/Q4.2.html)
to turn off printing headers (quoting an article I posted last week):
== == Q: how do u have sybase only return records you need WITHOUT the
== == column names and the ---- that comes after it?
== I suppose you're talking about isql? If so: up to isql 10.0.4 there's no
== option/command to do this. You have to strip it off with a sed/awk/perl
== script.
== isql 11.1 accepts the "-b" option to turn off printing of headers.
hope this helps
Martin
Sybase JDBC Development
m...@sybase.com
There is a direct equivalent to "SET FEEDBACK OFF" in "SET NOCOUNT ON".
Headers are a different matter. Historically, there has been no way to turn
them off using isql. However, version 11.1 of isql was recently released as
part of the 11.1 Open Client package, and it does have a command-line parameter
to turn off headers (but it applies to all queries in the session).
SET NOCOUNT ON is documented in the 11.x Reference Manual, Vol 1, page 3-317.
isql 11.1 is documented in the 11.1 Open Client documentation. Presumably,
isql 11.1 will be included in the next release of SQL Server, at which
point it will be documented in the "Utility Programs" guide.
--
---------------------------------------------------------------------
| Bret Halford Imagine my disappointment __|
| Sybase Technical Support in learning the true nature __|
| 6400 S. Fiddlers Green Circle of rec.humor.oracle... __|
| Englewood, CO 80111-4954 USA |
============================================================
I ran into this problem too. I ran an ISQL call from a Unix csh script
and redirected to a file. To get rid of the header, I processed the
output file using AWK. AWK ate the header for me. Sounds like a
kludge (and it is) but it was a quick and easy fix.
Dan
Try www.voicenet.com/~gray for a download.
George Kerber wrote:
>
> I have experience with Oracle, and am now trying to be a Sybase guy.
> In oracle I can write a sql statement like this
...
> Can isql do something like this? If so, please tell me how, and where
> the information of this form of control along with others is documented.
>
> Thanks in advance,
>
> George Kerber
> USWEST
--
+==================================================+
+ From: Peter WG Collard Senior DBA +
+ Lehman Brothers +
+ London +
+ Usual disclaimers apply.
+==================================================+
Yup. I've worked with both, and no, you can't do with isql what
you can do with SQL*Plus. Use awk.
=================
Mark Khoury
mar...@netcom.ca
Montreal, CANADA
I'm afraid those won't be the only things from SQL*Plus that you'll
miss. COLUMN, TTITLE, SPOOL ... They're all extensions. :-(
There is no way to turn the headings off. People either edit the output
file and delete the headers, or use awk to parse them out, or tail +n
to skip the first few records in the file. You get the idea.
You can prevent the number of rows affected being displayed at the end.
Try SET NOCOUNT ON. That should do it.
If you want a crash course in syntax, take a look at the Sybase-provided
procedures. I've learned a lot about how things work from those puppies.
Good luck,
Teresa Larson
___________________________________________________________________
/ Teresa A. Larson http://www2.ari.net/jmasino/ /
/ Bell Atlantic Voice: (301) 282-0051 /
/ 13100 Columbia Pike, A-3-3 Fax: (301) 282-9416 /
/ Silver Spring, MD 20904 Teresa....@bell-atl.com /
/__________________________________________________________________/
#include <std_disclaimer>
That's true for isql 10.0.4 and below. isql 11.1 supports the -b option.
If this flag is given the column headers will not be printed.
== You can prevent the number of rows affected being displayed at the end.
== Try SET NOCOUNT ON. That should do it.
That's correct.