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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -