Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / February 2010

Tip: Looking for answers? Try searching our database.

use not use the date parameters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnE - 04 Feb 2010 18:37 GMT
I have a report (and eventually more reports) that have the 2 date parameters
for start date and end date.  The users will want to only enter the start
date and not have to enter the end date which would return all appropriate
records from the start date going forward.  They also want to be able to
enter only the end date and get all appropriate records up to the end date.  
Is this possible in reporting services 2005 standard?  If so, where and how?  
I'm still learning this ssrs stuff, but getting better at it.
Thanks... John
Uri Dimant - 07 Feb 2010 09:20 GMT
JohnE

You may allow them to run the reports from Report Manager directly....
IF @startdate IS NULL
  SELECT <columns>FROM tble WHERE dt >=@startdate  AND dt
<DATEADD(d,1,@enddate)
ELSE
   SELECT <columns>FROM tble WHERE   dt <DATEADD(d,1,@enddate)

>I have a report (and eventually more reports) that have the 2 date
>parameters
[quoted text clipped - 7 lines]
> I'm still learning this ssrs stuff, but getting better at it.
> Thanks... John
JohnE - 07 Feb 2010 19:58 GMT
Uri, thank you for the reply.  I am a bit new to SSRS.  The user would be
running the report(s) from RM.  Where exactly would I put the IF statement?  
I'm thinking in the dataset, is that correct?

.... John

> JohnE
>
[quoted text clipped - 18 lines]
>
> .
Uri Dimant - 08 Feb 2010 09:13 GMT
Hi
Yep, or perhaps wrap your query within a stored procedure

> Uri, thank you for the reply.  I am a bit new to SSRS.  The user would be
> running the report(s) from RM.  Where exactly would I put the IF
[quoted text clipped - 28 lines]
>>
>> .
Bruce L-C  [MVP] - 08 Feb 2010 14:26 GMT
To allow Null you have to check that box for the dates. Instead of an if
statement you can just combine into one statement. Taking Uri's code:

SELECT <columns>FROM tble WHERE (dt >=@startdate  AND dt <
DATEADD(d,1,@enddate)) or
(dt <DATEADD(d,1,@enddate) and @startdate is null)

Signature

Bruce Loehle-Conger
MVP SQL Server Reporting Services

> Uri, thank you for the reply.  I am a bit new to SSRS.  The user would be
> running the report(s) from RM.  Where exactly would I put the IF
[quoted text clipped - 28 lines]
>>
>> .
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.