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 |
jaroot
Starting Member
46 Posts |
Posted - 2005-08-19 : 10:52:07
|
[code]SELECT *FROM itemWHERE CASE WHEN @itemType = 'A' THEN columnA WHEN @itemType = 'B' THEN columnB WHEN @itemType = 'C' THEN columnC END = 1[/code]This works.. but I need to figure out a way to get the ' = 1' portionto be '= 0' or '<> 1' as well. If i try to include it after the column within the case, I get an error on the '='Thanks in advance! |
|
Kristen
Test
22859 Posts |
Posted - 2005-08-19 : 11:02:22
|
Sorry, can you exaplin the problem you are trying to solve?Unless you mean some thing like this:WHERE (@itemType = 'A' AND columnA = 1) OR (@itemType = 'B' AND columnB = 0) OR (@itemType = 'C' AND columnC <> 1) Kristen |
 |
|
jaroot
Starting Member
46 Posts |
Posted - 2005-08-19 : 11:18:41
|
quote: Originally posted by Kristen Sorry, can you exaplin the problem you are trying to solve?Unless you mean some thing like this:WHERE (@itemType = 'A' AND columnA = 1) OR (@itemType = 'B' AND columnB = 0) OR (@itemType = 'C' AND columnC <> 1) Kristen
Yep that'll work... thanks!!! |
 |
|
|
|
|