How to convert SQL Server XML type value (xsi:nil) of DateTime to null?

The "default" datetime is caused by casting an empty string which is "zero" which gives 01 jan 1900 So: tidy the string, then CAST declare @data xml set @data = '' select Value1 = CAST(NULLIF(@data. Value('/DOD1', 'varchar(30)'), '') AS datetime).

The "default" datetime is caused by casting an empty string which is "zero" which gives 01 jan 1900. So: tidy the string, then CAST declare @data xml set @data = '' select Value1 = CAST(NULLIF(@data. Value('/DOD1', 'varchar(30)'), '') AS datetime).

I think your approach looks better than what I was trying to do, which is ------ nullif(@data. Value('string(/DOD1/@xsi:nil="true")', 'varchar(4)'), 'true') – Sung Jul 29 '09 at 20:20.

Easy: declare @data xml set @data = '' select Value1 = @data. Value('(/DOD/text())1', 'varchar(30)') best regards schacki.

Value1 & Value2 both returns 1900-01-01 00:00:00.000. Is there a way to return a null, instead? Without using nullif?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions