读书人

查询过程中怎么将当前年月设置为列的

发布时间: 2012-05-16 11:12:12 作者: rapoo

查询过程中,如何将当前年月设置为列的标题
我想设置查询语句,将当前月份设置为列的标题,如
select A.date as '当前年月'from A

因为当前年月是随时间变换的,可以随着显示2011.7,2011.8,2011.9....

应该怎么设置呢

[解决办法]

探讨
SQL code


exec('select A.date as ['+convert(varchar(6),getdate(),120)+'] from A')

读书人网 >SQL Server

热点推荐