Results with no column headers

  • How do you get query results with no column headers using a SET command?

  • I don't know. But this gives you a result set with no column headers:

    SELECT 123, 456


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • There is very less information. You could may be post DDL and some sample data to elaborate on your requirement a little more.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • I don't think it can be done using a SET command. Showing or hiding column headers is something that happens on the client side, not at the server side.

    You can use the sqlcmd utility to query the database and suppress headers:

    sqlcmd -h-1

    For more information see sqlcmd Utility.

    Hope this helps

    Gianluca

    -- Gianluca Sartori

  • Are you talking about when you copy/paste from SSMS?

    in Management Studio, it's an option you can turn on and off:

    Tools>>Options>>Query Results>>SQL Server>>

    Results To Grid has a checkbox for "Include column headers when copying or saving results"

    Results to Text has a similar checkbox for "Include column results in the result set"

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply