I realise that there are other threads covering this but I can't find one that solves my problem.
I have three text columns that either contain a date or nothing (null), I'm converting the text to a date in order to use date filters once the date makes it to Excel.
Obviously, the null values get converted to '1900-01-01' but I can't find a way to show them as blanks, even with a subquery.
This is what I'm doing...
Select top 999999999
OtherFields,
case when Engdate = '19000101' then '' else Engdate end as 'EngDate',
OtherOtherFields
from
(
select
OtherFields,
case
when VAR_AppID = '3' then nullif( CONVERT(date,concat(right([2201],4),
SUBSTRING([2201],4,2), left([2201],2))),null)
else nullif( CONVERT(date,concat(right([3429],4),
SUBSTRING([3429],4,2), left([3429],2))),null) end as 'Engdate',
case when ([2201] is not null and Len([2201]) = 10 ) then
CONVERT(date,concat(right([2201],4), SUBSTRING([2201],4,2), left([2201],2)))
else null end as 'EngagementRec',
OtherOtherFields
from
Tables
)
The fields [2201], and [3429] are the text fields that contain the dates in 'dd/mm/yyyy' format.
Am I supposed to covert back to a text format to allow the '' to show a blank - and if so, will the dates still be recognised as dates?