Suppression of Column Heading Text when executing store procedures

  • I wish to use 'Results to File' option when executing a stored procedure and for the resultant dataset not to have embedded space characters. I have tried to find any execute option that allows me to suppress the column heading text and the '---------....' underline, but can't.

    Is this possible, and will it suppress redundant space characters as well?

  • Hello,

    In SSMS, you can use the following option to get rid of the headers:-

    Tools, Options, Query Results, Results to Text, Include Column Headers in the Result Set

    If you want a single space between each data item, you can try changing the Output Format on the same options page to “Space Delimited”.

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • In addition to the advice above, if you plan to do this on a regular basis, you should familiarize yourself with bcp (bulk copy program). It is a command line executable that comes with SQL Server. This will make it easier to automate this type of process.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Thanks heaps for the advice John.

    The column headers were gone, but still had all the embedded blanks. I had included a | character to be used as a delimiter in my script so I removed that and then set the Output Format/Custom Delimiter to |.

    Works like a treat.

    Also, thanks Robert for the BCP advice. I'll do some further investigation.

    Peter

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

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