sql server - sql case statement with date values -


i have date column in database table.

select sdestructiondate tbldocumentheader 

below result of above query

enter image description here

i need print empty date value '1991-01-01'

i expect result set below.

enter image description here

i tried below query still print '1991-01-01' date.

select case convert(date,h.sdestructiondate,103)  when '01/01/1991'  ''  else convert(date,h.sdestructiondate,103) end  'sdestructiondate' tbldocumentheader h 

i don't want convert result varchar value. below query gives me result need return date format.

select case convert(varchar,h.sdestructiondate,103)  when '01/01/1991'  ''  else convert(varchar,h.sdestructiondate,103) end  'sdestructiondate' tbldocumentheader h 

i first convert null:

select     case         when h.sdestructiondate = '01/01/1991' null         else h.sdestructiondate     end sdestructiondate tbldocumentheader h 

then reporting tool present blank if value null


mixing data presentation mistake. approach simple , keeps 2 concerns of data , rendering separate.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -