SQL server datetime column filter on certain date or range of dates

Posted by MicMit on Stack Overflow See other posts from Stack Overflow or by MicMit
Published on 2010-05-12T05:57:54Z Indexed on 2010/05/12 6:04 UTC
Read the original article Hit count: 166

Filed under:
|

There is an example for today here

http://stackoverflow.com/questions/2583228/get-row-where-datetime-column-today-sql-server-noob

I am primarily interested in 2008 only. For today it looked like

SELECT (list of fields)
FROM dbo.YourTable
WHERE dateValue BETWEEN 
   CAST(GETDATE() AS DATE) AND DATEADD(DAY, 1, CAST(GETDATE() AS DATE))

What literal value of date(s) or functions ( I need a format ) should I place there to make it work independent of local settings.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about datetime