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 |
|
mavershang
Posting Yak Master
111 Posts |
Posted - 2009-11-04 : 16:00:57
|
| Hi there. Here is my problem.table is likeA B10 2011 21...select case when A is null then '0' else cast(A as varchar(2)) end from table where B = @ParamNow if there is no match result, it return blank but not null, therefor, nothing displayed. My question is how to treat this blank as Null so there is sth displayed.Thanks |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2009-11-04 : 23:15:23
|
I'm not really sure if this is what you want, actually, I'm not really sure why you'd want a null, but just for the sake of it...it sounds like you want this:select case when A is null then '0' else cast(A as varchar(2)) end from @testwhere B = @Paramunionselect null as resultfrom tablewhere not exists (select B from table where B=@param) --I'm not schooled in the science of human factors, but I suspect that surprise is not an element of a robust user interface. |
 |
|
|
|
|
|