Groups | Blog | Home
all groups > sql server reporting services > november 2004 >

sql server reporting services : Date range validation


jules_crown NO[at]SPAM hotmail.com
11/19/2004 2:35:56 PM
Hi,

forgive the newbee. I have a 'from' and a 'to' date input parameters
(nullable) used in the WHERE section of my query.

I can't find a way to make 'to' (when set) a dependency of 'from',
i.e. if the user chooses a 'from' date, the available values for 'to'
should be >= 'from'

Advice, anyone? Cheers,
Alien2_51
11/19/2004 3:49:03 PM
If you're talking about conditionally add the filter to your where clause,
something like this will work.

SELECT * FROM Table
WHERE
((@FromDate IS NULL) OR (@FromDate IS NOT NULL AND cs.DateSold >= @FromDate))
AND ((@ToDate IS NULL) OR (@ToDate IS NOT NULL AND cs.DateSold <= @ToDate))

[quoted text, click to view]
AddThis Social Bookmark Button