Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2015-04-29 : 03:58:08
|
Hi May I ask on how to work on this in SSRS/SQL Query. I have a query that need to have a filter condition using Modifieddate between @fromdate and @todate and @employeeNumber while the other choices is to filter if modifieddate > @fromdate and @employeeNumber.basically if @todate is empty will do the this filter conditionmodifieddate > @fromdate and @employeeNumberwhile if @todate is not empty will do this Modifieddate between @fromdate and @todate and @employeeNumber Select* From sampleWhere modifieddate > @fromdate and @employeeNumberor Modifieddate between @fromdate and @todate and @employeeNumber Thank you in advance. |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2015-04-29 : 04:11:49
|
[code]Select* From sampleWhere ( (modifieddate > @fromdate AND @todate IS NULL) or (Modifieddate between @fromdate and @todate) ) and @employeeNumber[/code]sabinWeb MCP |
|
|
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2015-04-29 : 04:34:05
|
Thank you. I Run the SSRS and got this message. Please enter a value for the parameter 'todate' the parameter cannot be blank. what should i do in the @todate parameter. thanks. |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2015-04-29 : 04:49:54
|
Try to check , for parameters , the <ALLOW NULL VALUES> and/or the <Default Values> to NULL ,sabinWeb MCP |
|
|
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2015-04-29 : 04:58:47
|
Yes stepson. I tick the allow null value and its working now. Thank you very much. |
|
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2015-04-29 : 05:02:25
|
You're welcome!sabinWeb MCP |
|
|
|
|
|