简体   繁体   English

如何在SSRS表达式中检索当前月份

[英]How to retrieve current month in SSRS expression

I want to get current month as default value of a parameter. 我想获取当前月份作为参数的默认值。 I've come up with (which does not work): 我想出了(这不起作用):

=Month(Now())

If you want to get the month as an int that goes from 1 to 12, you can use this 如果您希望将月份作为从1到12的整数,则可以使用此

SELECT MONTH(GETDATE())

This answer was based on the official documentation that you can see in here - http://technet.microsoft.com/en-us/library/ms187813.aspx 该答案基于您可以在此处查看的官方文档-http://technet.microsoft.com/zh-cn/library/ms187813.aspx

Edit 编辑

For reporting services specifically, you can use 对于报告服务,您可以使用

MonthName(NOW())

This will return a month name and i believe is the function you're looking for. 这将返回一个月份的名称,我相信这是您要查找的功能。

Or, in case you want the month as an integer, try using 或者,如果您希望月份为整数,请尝试使用

Month(TODAY())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 返回当前月份和年份以及1个月的SSRS /表达式 - Return current month and year plus 1 month SSRS/Expression 如何在SSRS报表中获取当月的开始和结束日期 - How to get Current Month's Starting and End dates in SSRS report SQL SSRS当前月份与月份值匹配 - SQL SSRS current month from month value match 如何在sql中检索上个月的最新日期和本月的最新日期 - how to retrieve previous month latest date and current month latest dates in sql 如何基于yyyymmdd检索当年的月份和去年的同一个月 - how to retrieve month current year and same month last year based on yyyymmdd 如何根据年份和月份动态检索一年前(下个月)到当前月末的所有数据 - How to dynamically retrieve all data from a year ago (Next Month) till the end of current Month based on year and month 检索当前月份和上个月的最后一条记录 - Retrieve last record from current month and previous month 如何从一个表中检索所有记录并与当月记录一起 - how to retrieve all records from one table in join with current month records 如何在 sql 中检索当年有记录的月份名称列表? - How do I retrieve a list of month names where there are records within a current year in sql? 如何在 SSRS 表达式中使用 If Else - How to use If Else in SSRS expression
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM