Click here to Skip to main content
12,690,140 members (30,415 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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 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__ 19-Feb-13 0:59am
   
Try
SELECT CASE WHEN [YourColumnName] IS NULL THEN '-' ELSE [YourColumnName] END
FROM [YourTableName]
   
Null?! No kidding?
—SA
Member 8076338 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!
:)
  Permalink  
Comments
Member 8076338 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170117.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
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