Link to home
Start Free TrialLog in
Avatar of sherbug1015
sherbug1015Flag for United States of America

asked on

SQL Server Optional Parameters

I am writing a stored proc for an SSRS report.  The user wants the report to bring back all the data on the first run and then allow the user to set 4 parameters.  I initially created the report to show nothing until the user selected parameters, but they want all data returned and then filter it out.  

I have four parameters  @LiveDate datetime = Null, @Status bit = Null,@CarType varchar(30) = NULL,@somethingelse varchar(30) = NULL

Then I have a select statement.  It the WHERE clause that I am confused about.  If the parameters are NULL, then I want to return everything  and if not then return according to the parameter values.

Can someone help me with the WHERE clause here.  

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial