Syrrea Lee
Syrrea Lee

Reputation: 101

Add header title above the query result in SQL Server

How can I add heading title for each query?

I want to display it as a report with a heading above the query result of the table.

Something like this

         HEADING
_____________________________
Alexis M. Smith | PHP 140,500
Johnny K. Black | PHP  50,000
James P. Blonde | PHP  30,000

I am using sql server management 2012 Studio and vb.net 2010 I don't have Business Intelligence to create a report from the sql server to vb.net 2010

Upvotes: 4

Views: 18536

Answers (2)

VTi
VTi

Reputation: 1319

Select b.a  AS Heading
  FROM
    ( Select Concat('Mr. Xyz', ' |  ', 'PHP' , ' | ' , '50000') AS a
    ) B

This is the closest I could think.

Upvotes: 1

Raju Prasai
Raju Prasai

Reputation: 106

You may can't add header in your query result in SQL-Server and show the result in your application..

But if you are asking to show the result in SQL-Server only, then this might help you..

--You have to add one select query before your actual query like this.
select '' as 'Your Heading Here' where 1!=1
select * from your_table

Upvotes: 4

Related Questions