2
How to concatenate two dates of the type DateTime
, one of which may have its value equal to NULL, I’m trying this way;
DECLARE @DATA1 DATETIME = GETDATE(), @DATA2 DATETIME
select Convert(nvarchar(50),@DATA1 , 121) +'|'+ Convert(nvarchar(50), @DATA2, 121)
But it returns null
, when I really wanted the value of GETDATE() + something like empty or null.
Everything you concatenate with NULL will result in NULL, so you first need to change null to something else, and then concatenate. The @Ricardo response is correct.
– Caffé