...

View Full Version : SQL Server DateTime Problem



Cipher
09-21-2005, 11:56 PM
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.

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

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

Cipher
09-22-2005, 10: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:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum