Parameter/s are used to filter report data. We often has column/s in table which are date or datetime type. If we would like to use those column/s in our SSRS Report, we can create the parameter and have the Calendar icon to choose date.
Let's say we have a column in a table such as CreatedOn of Date type, we can write our query as below
After using the query in SSRS Report, we will see the Text Box for our parameter. As we want to have the Calendar, we need to change the parameter Data Type.
Right Click on the Parameter, go to properties and change the data type to Date/Time as shown below.
Let's say we have a column in a table such as CreatedOn of Date type, we can write our query as below
SELECT Col1Name ,Col2Name FROM dbo.MyTable WHERE CreatedOn = @Param_CreateDOnIf we have column which is datetime and we would like to use only date part of it to filter our records by using parameter, our TSQL Query will be like below
SELECT Col1Name ,Col2Name FROM dbo.MyTable WHERE Cast(CreatedOn AS DATE) = @Param_CreateDOn
After using the query in SSRS Report, we will see the Text Box for our parameter. As we want to have the Calendar, we need to change the parameter Data Type.
Right Click on the Parameter, go to properties and change the data type to Date/Time as shown below.
How to show calendar Parameter in SSRS Report - SSRS Interview Question
No comments:
Post a Comment