Click here to Skip to main content
11,642,216 members (67,456 online)
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 18: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)



Advertise | Privacy | Mobile
Web02 | 2.8.150731.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