Click here to Skip to main content
11,709,536 members (49,759 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL-Server VB.NET
Good afternoon guys,

How can i query and (display or change) it into a dash if the data in the specific column is null using case?

Thank You, any suggestions and opinion, will be so much appreciated!.
Posted 18-Feb-13 18:48pm
Arun1_m1 at 19-Feb-13 0:51am
Can you let us know the exact output what is intended, this would be helpful in giving an exact solution.
__TR__ at 19-Feb-13 0:59am
SELECT CASE WHEN [YourColumnName] IS NULL THEN '-' ELSE [YourColumnName] END
FROM [YourTableName]
Sergey Alexandrovich Kryukov at 19-Feb-13 1:05am
Null?! No kidding?
Member 8076338 at 19-Feb-13 4:13am
Thanks a lot guys, it works :)

I try Aarti Meswania and __TR__ posted. and it successfully works.

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

select IsNull(ColNm,'-') from TblNm
select case when ColNm is null then '-' else ColNm end as ColNm from TblNm
Happy Coding!
Smile | :)
Member 8076338 at 19-Feb-13 4:06am
Thanks a lot guys, it works :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Hi Friend,

Please try the below query,

select isnull(name,'')  from sales  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 565
1 OriginalGriff 250
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,037
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100