A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

More dates issues



 
 
Thread Tools Display Modes
  #1  
Old May 29th, 2004, 07:17 PM
Mike
external usenet poster
 
Posts: n/a
Default More dates issues

Hello,
The dates in a SQL2k table are stored as nvarchar (yyymmdd). When displayed,
the CAST (DATE_FIELD AS datetime) syntax is used. Because of the given
format, when the DATE_FIELD has no dates, the empty field is converted into
01/01/1900. What is needed to keep 01/01/1900 from desplaying in a query and
keeping the field empty?
TIA
Mike


  #2  
Old June 1st, 2004, 12:24 PM
Gary Walter
external usenet poster
 
Posts: n/a
Default More dates issues


"Mike" wrote

The dates in a SQL2k table are stored as nvarchar (yyymmdd). When displayed,
the CAST (DATE_FIELD AS datetime) syntax is used. Because of the given
format, when the DATE_FIELD has no dates, the empty field is converted into
01/01/1900. What is needed to keep 01/01/1900 from desplaying in a query and
keeping the field empty?


Hi Mike,

Did you try using CASE/WHEN?

CASE
WHEN (DATE_FIELD IS NOT NULL)
THEN CAST (DATE_FIELD AS datetime)
ELSE NULL
END

But are you sure you want to do this? I think
I would prefer 1/1/1900 to Null, but you
know your situation best.

Good luck,

Gary Walter


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.