Controlling Query Output Destination & Fromat Options w/ TSQL

  • I have a query that outputs table metadata into a complet html report format. In order for the query to work properly, however, the user has to take two steps manually and I would like to see if there is a statement that can be embedded in the script so the user doesn't have to take these steps. The query just runs from within Enterprise Manager--I need it for students who need to report on DB structures without installing Reporting Services.

    The two steps are:

    1. Setting the output of the query to text instead of to the default grid. (You do this in Enterprise Manager by selecting Query | Results To... | Results to Text (or by typing Ctrl-T or clicking the icon button).

    2. Suppressing the column headers in the result set. In Enterprise Manager this is accomplished by selecting Query | Query Options... | Results-Text and then clearing the "Include column headers in the result set" check box.

    I'm hoping that there will be something like SET NOCOUNT ON (which I use) to address each of these requirements.

  • What about using sqlcmd to control the execution & output of the script?

    There are not TSQL commands that take control of Management Studio and its behavior.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 1 (of 1 total)

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