Click here to Skip to main content
Rate this: bad
good
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 19:48pm
Comments
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
   
Try
SELECT CASE WHEN [YourColumnName] IS NULL THEN '-' ELSE [YourColumnName] END
FROM [YourTableName]
Sergey Alexandrovich Kryukov at 19-Feb-13 1:05am
   
Null?! No kidding?
—SA
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.
 
GOD BLESS.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

Solution 3

Hi Friend,
 
Please try the below query,
 

select isnull(name,'')  from sales  
  Permalink  

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

  Print Answers RSS
0 Dnyaneshwar@Pune 719
1 CPallini 315
2 Sergey Alexandrovich Kryukov 310
3 Peter Leow 280
4 CHill60 235
0 Sergey Alexandrovich Kryukov 9,008
1 OriginalGriff 6,771
2 Peter Leow 4,262
3 Zoltán Zörgő 3,769
4 Richard MacCutchan 2,623


Advertise | Privacy | Mobile
Web04 | 2.8.150128.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