Forums
This topic is locked
SQL and Date problem
01 Oct 2002 15:44:13 Stefan P posted:
I've been looking into the various resolutions to this one but no joy.I've got an SQL query that read as follows:
SELECT *
FROM Publications
WHERE PublicationDate BETWEEN 19/12/2001 AND 21/12/2001
It doesn't return any records even though there are over 20 for the PublicationDate 20/12/2001. The Datatype in ACCESS is Date/Time.
Any thoughts
UltraDev4, IIS5, ASP, VBScript, ACCESS
Replies
Replied 01 Oct 2002 16:56:14
01 Oct 2002 16:56:14 Brent Colflesh replied:
Dear Sesame,
It's been awhile since I've used Access, but I believe you need to have a hash in front of the date:
WHERE PublicationDate BETWEEN #19/12/2001 AND #21/12/2001
Regards,
Brent
It's been awhile since I've used Access, but I believe you need to have a hash in front of the date:
WHERE PublicationDate BETWEEN #19/12/2001 AND #21/12/2001
Regards,
Brent
Replied 01 Oct 2002 17:06:41
01 Oct 2002 17:06:41 Stefan P replied:
Thanks Brent
Although your suggestion is not quite right it did help remind me how to do it, ie put # either side of the date:
SELECT *
FROM Publications
WHERE PublicationDate BETWEEN #19/12/2001# AND #21/12/2001#
Cheers
Although your suggestion is not quite right it did help remind me how to do it, ie put # either side of the date:
SELECT *
FROM Publications
WHERE PublicationDate BETWEEN #19/12/2001# AND #21/12/2001#
Cheers