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 |
|
csphard
Posting Yak Master
113 Posts |
Posted - 2005-09-15 : 14:32:17
|
| I have a screen where I could pass 8 parameters.section, (3 digit number)division, (3 digit number)bureau, (3 digit number)evaluation type (annual,probation,all)from date mm/yyyyto date mm/yyyyHowever the following 4 of those paramters are optional.section, (3 digit number)division, (3 digit number)bureau, (3 digit number)evaluation type (annual,probation,all)How do I build if statements into my store procedure to account for these if they are present |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-09-16 : 00:16:36
|
| DECLARE @section = NULL, @division = NULL, etcYou then need to test for NULL in your WHERE clauses. WHERE (@section IS NULL OR section = @section) AND (@division IS NULL OR division = @division)MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|