Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DateTime comparison
Message
 
To
03/04/2009 20:04:13
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Application:
Web
Miscellaneous
Thread ID:
01392907
Message ID:
01393234
Views:
44
>Hi,
>How to use this function to have BETWEEN ... AND ... comparison?
>
>Thank you

Don't. Just use >= and < .
--- If you want ALL records between 01 Apr 2009 and 15 Apr 2009
DECLARE @StartDate datetime
DECLARE @EndDate datetime
SET @StartDate = '20090401'
SET @EndDate = '20090416' -- 16 not 15


SELECT .....
FROM ....
WHERE SomeDateTimeField >= @StartDate AND
      SomeDateTimeField <  @EndDate
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform