Home > Software engineering >  Null Date return 1900-01-01
Null Date return 1900-01-01

Time:10-05

If [ADRCBook Details].RCBDatecolumn is NULL; I move [Transaction Details].TDJournalDatecolumn instead of that.

isnull(convert(date,[ADRCBook Details].RCBDate,112),isnull(convert(date,[Transaction Details].TDJournalDate,112),''))

Part of the query I mention above. My problem is I get 1900-01-01. I need blank ('') if both of the columns are NULL.

CodePudding user response:

If I understood correctly what you need:

isnull(cast(convert(date, isnull([ADRCBook Details].RCBDate, [Transaction Details].TDJournalDate), 112) as varchar), '')

Of course instead of cast you can use convert. The main point is to discard the date type information.

  • Related