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 |
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-14 : 06:09:58
|
| I have [CODE]CASE WHEN (a.type_id in (9)) THEN a.duration ELSE 0 --CAST ( expression AS data_type ) END 'Time'[/CODE]I need the duration to be displayed if type is 9 only.so otherwise id ideally want 'N/A' displayed..but it won't display it as its not an int .. is there a way i can just display it temporarily instaed of 0 ? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-14 : 06:13:57
|
| [code]CASE WHEN (a.type_id in (9)) THEN cast(a.duration as varchar(10)) ELSE 'N/A'END 'Time'[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-14 : 06:14:44
|
| PS [CODE]ELSE (CAST (a.duration as varchar(10)) AND 'N-A') [/CODE]doesn't work either... |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-14 : 06:15:49
|
| CASE WHEN (a.type_id in (9)) THEN cast(a.duration as varchar(10)) ELSE 'N/A'END 'Time'im not sure this will work as i need to display the duration in this case .. ie the int .. |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-14 : 06:21:28
|
| sorry it does work .. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|