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 |
|
ismailc
Constraint Violating Yak Guru
290 Posts |
Posted - 2010-02-28 : 06:37:47
|
| Good day,I'm struggling to remove null rows dependant on a certain criteria in my where clauseI want remove null only when the VStatus is not "Open"I have done a few where case but not where is not null then do nothingeg: where ..and DisplayName <>(case when EventID='390' then 'Site' else '1' end)but to remove nulls:and DisplayName is not (case when VStatus<>'Open' and DisplayName is null then Null else ? end)Not to sure how as i tried a few thingselse "1") - but i Also get error incorrect syntax at is not Please help |
|
|
ismailc
Constraint Violating Yak Guru
290 Posts |
Posted - 2010-02-28 : 07:37:29
|
| I got help :)WHERE 1 = (CASE WHEN vStatus <> 'Open' AND DisplayName IS NULL THEN 0 ELSE 1 END) |
 |
|
|
DBA in the making
Aged Yak Warrior
638 Posts |
Posted - 2010-02-28 : 07:55:48
|
| You could do the same thing with:WHERE vStatus = 'Open' OR DisplayName IS NOT NULLThat seems much simpler to me.There are 10 types of people in the world, those that understand binary, and those that don't. |
 |
|
|
|
|
|