Mark
Mark

Reputation: 79

Null Date return 1900-01-01

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.

Upvotes: 0

Views: 824

Answers (1)

Miroslav Penchev
Miroslav Penchev

Reputation: 176

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.

Upvotes: 1

Related Questions