Click here to Skip to main content
16,019,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
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]
Sergey Alexandrovich Kryukov 19-Feb-13 1:05am    
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.

Hi Friend,

Please try the below query,


SQL
select isnull(name,'')  from sales  
 
Share this answer
 
SQL
select IsNull(ColNm,'-') from TblNm

--Or--
SQL
select case when ColNm is null then '-' else ColNm end as ColNm from TblNm

Happy Coding!
:)
 
Share this answer
 
Comments
Member 8076338 19-Feb-13 4:06am    
Thanks a lot guys, it works :)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900