Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2796

Re: Evaluate date field, use only if not null/empty in query.

$
0
0

Hi John,

 

I guess your problem is that things aren't the way we might intuitively expect them to be.

While LastReqTime looks like a datetime, it technically is a varchar (255) as you'll see in the sa_conn_info reference. As a bonus, an empty LastReqTime is not null, but an empty string (blank string?). I can't currently retrieve a row with an empty value, in case of doubt check the length of a value that you have trouble with or retrieve the ASCII () function. Assuming it is an empty string, check for NULLIF (LastReqTime, '') instead of just LastReqTime. You might also use the ISDATE () function which indicates if the string value is a valid date and/or time.

 

HTH

 

Volker


Viewing all articles
Browse latest Browse all 2796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>