Filtering Date (Show All Records)
Posted on 2013-12-24
I filter a SQL statement to allow records to be displayed that sit within a specific date range, i.e. show all records from the last 30 days
object_audit_info.action_date >= DateAdd(Day, DateDiff(Day, 0, GetDate()) - @NoOfDays, 0)
I do this by passing an int containing the filter value @NoOfDays, the trouble I now have is how to accommodate where I want to display all records?
At the moment when the user requests this the system passes 0, if there any way of telling the SQL statement not run the where clause if the parameter @NoOfDays contains a 0 ?