View Full Version : SQL Server DateTime Problem

09-22-2005, 12:56 AM
i'm having a web forum and i wanna make a page to show all Today's Posts, and i'm using MS SQLServer 2000, so i tried to do this in the SQL Statment:

Where Posts.DatePosted Between #09/20/2005# AND #09/22/2005#

But it appeared this error:

Incorrect syntax near '#'.

So can any body tell me a good way to do this.

09-22-2005, 07:23 AM
Where Posts.DatePosted Between '09/20/2005' AND '09/22/2005' works fine for me

09-22-2005, 09:15 AM
# is only used in Access.

09-22-2005, 11:09 AM
Thank u too much, nancy ur solution worked, thanx, but i made it like this and it worked perfect:

HAVING MAX(Posts.DatePosted) >= '09/22/2005' AND MAX(Posts.DatePosted) < '09/23/2005' :thumbsup: