• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

putting descriptions between different SELECTS in a Stored Proc

for simplicity sake, let's say there are 5 different SELECTS in a stored proc.. all the job for the stored proc is to return the 5 result sets to the user.

is there a way to put a description of the result set before each one is displayed?

3 Solutions
You can use comment
25112Author Commented:
i mean the output that the user will be seeing on the resultset.. ( are you saying comment inside your code)
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

25112Author Commented:
in my case, there will be lot more columns.. in this example, it worked good as there was only one column to output.. i want to give a title for each result set.
Anthony PerkinsCommented:
I have no idea why you would want to do this, but if you insist you coud do something like this:

SELECT 'Description for query1'
SELECT query1 ...

SELECT 'Description for query2'
SELECT query2 ...

SELECT 'Description for query3'
SELECT query3 ...

SELECT 'Description for query4'
SELECT query4 ...

SELECT 'Description for query5'
SELECT query5 ...

Add a column Description to each recordset
SELECT 'Your description here' as Description , column1, ...columnN FROM ....

25112Author Commented:
it is a requirement given.. your ideas will fit the bill.

thanks much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now