Skip to Content
author's profile photo Former Member
Former Member

Toggle table header output on/off

Hi all,

I know isql has the -b parameter that suppresses table header output, but is there any way to turn it back on? I'm running a stored procedure that outputs some data, and I'd like the headings to be in effect for that display, but to be off all the rest of the time.

Is there a SET command that can control table headers during an isql session?

Thanks and regards,

Dan

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    Posted on Jul 15, 2016 at 08:01 PM

    Use -b on the isql side and use "print" statement inside the procedure to output custom header lines where you need them.

    To speed up your work you can first capture the header(s) you need with a normal isql run first.

    print "<your captured header>"

    print statement also has parameter substitution format where you can put heading and variable values side by side.

    e.g. with two variables @myname and @mystate

    print "My name is %1! and I live in %2! state ", @myname, @mystate

    will print something like this assuming proper values in the two variables.

    My name is Avinash and I live in Indiana state.

    HTH

    Avinash

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 18, 2016 at 12:34 PM

    Boy, how lucky that ASE doesn't have a directive like <set headers on/off>, so that such interesting adventures through different sql editors can be explored. 😊

    Fortunately, I don't need a machete to hack a path through this jungle. I'm working in a controlled environment where these procedures have a fixed structure and are used for a specific purpose (namely to validate the correctness of data that is being processed into or out of production tables). I want the ability to display certain content so it can be captured by a shell script and attached to notification emails and/or redirected to log files.

    I had mostly been using SELECT to display single values, but then ran into the need to dump a #temp table that will never have many rows.

    So the solution is clear. I'll remove the -b flag from the isql call and use PRINT with parameter substitution for the regular info messages and SELECT for dumping tables.

    This is pretty much as good a solution as being able to toggle headers.

    Thanks for all the analytical insights.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 15, 2016 at 07:34 PM

    Since the ability to hide/display headers is a client (isql in this case) setting, ASE would need some means of sending a signal to the client that says to override the client's show/hide header setting. ("Duh, Mark!" ?)

    I'm not aware of any such ASE command, and I don't see any (obvious) commands in the latest/greatest ASE commands reference manual [ ASE 16.0 SP02 PL04 Reference Manual : Commands ]

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 16, 2016 at 01:52 AM

    While isql does not have a command option to turn the display of headers on and off,

    the sqsh client does have such a command ("headers"). So in terms of having this

    capability under the control of the end user, I'd suggest using sqsh rather than isql.

    It doesn't really help in this instance though (for reasons discussed by others)

    as you want to control the display from the procedure running on the server side

    - where your code doesn't really have any way of knowing just which client application

    is executing the procedure anyway. (Just because the client application claims to be

    "isql" doesn't mean it is the isql that SAP provided with ASE...).

    -bret

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.