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 |
|
gwjones12
Starting Member
9 Posts |
Posted - 2011-04-04 : 12:23:02
|
| I have a field that contains either a 'Y' or 'N' and a parameter coming into the SP with either 'Y' or NULL. I need a WHERE clause that says "If the parameter passed in is 'Y' then select where the field = 'Y' else don't filter on this field at all (bring back all records)"Thanks |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-04-04 : 12:29:46
|
| WHERE field = parameter or isnull(parameter,'') = ''JimEveryday I learn something that somebody else already knew |
 |
|
|
gwjones12
Starting Member
9 Posts |
Posted - 2011-04-04 : 12:45:41
|
| Works great, thanks |
 |
|
|
|
|
|