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 |
|
Kurmanc
Yak Posting Veteran
92 Posts |
Posted - 2008-01-22 : 05:58:41
|
| Today it looks something like this:....SELECT id = CASE WHEN (amount1 = 0 OR amount1 IS NULL) THEN 10 END ,total = CASE WHEN (amount1 IS NULL) THEN amount2 ENDFROM OrderI want to handle amount1 = 0 for total. But I know following doesn't work:WHEN (amount1 = 0) THEN exec sp_Test 3, 3, 0 Can I make it work with an if-statment inside the select? Note, amount1=0 exists inside "id = CASE...", so an if-statement for amount1=0 for total shouldn't affect amount1=0 for id.Thx in advance. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
|
|
Kurmanc
Yak Posting Veteran
92 Posts |
Posted - 2008-01-22 : 06:27:45
|
| harsh_athalye, I understand. That is why I asked members if they have an idea how to solve my question with an if-statement. |
 |
|
|
Kurmanc
Yak Posting Veteran
92 Posts |
Posted - 2008-01-22 : 07:01:48
|
| Hi,I managed to solve it with an if/else-statement. Regards |
 |
|
|
|
|
|