在 SQL Server 中的查询结果上方添加标题标题 [英] Add header title above the query result in SQL Server

查看:126
本文介绍了在 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.

像这样

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

我正在使用 sql server management 2012 Studio 和 vb.net 2010我没有商业智能来创建从 sql server 到 vb.net 2010 的报告

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

推荐答案

您可能无法在 SQL-Server 中的查询结果中添加标题并在您的应用程序中显示结果..

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

但是如果您要求仅在 SQL-Server 中显示结果,那么这可能对您有所帮助..

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

这篇关于在 SQL Server 中的查询结果上方添加标题标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆