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

There is an example for today here

Get row where datetime column = today – SQL server noob

  • Converting seconds into HH:MM:SS format
  • java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver : Am I loading the right driver?
  • SQL Server : how to combine CASE WHEN IS NULL with OR statement
  • How to get data preferentially from the joined tables in SQL Server
  • sql statements with equals vs in
  • 'Error!: could not find driver' after installing php_mssql.dll on WampServer
  • I am primarily interested in 2008 only. For today it looked like

    SELECT (list of fields)
    FROM dbo.YourTable
    WHERE dateValue BETWEEN 

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

  • How to Multiply all values within a column with SQL like SUM()
  • Permissions error when attaching a database: “Cannot access the specified path”
  • SQL Server: Splitting string by '/' and put each split element into a different column
  • SQL Server Bulk Insert
  • SQL Server Operating system error 5: “5(Access is denied.)”
  • SQL Server : changing a temp column value
  • One Solution collect form web for “SQL server datetime column filter on certain date or range of dates”

    Your query will work as it stands because it uses date/time datatypes only. That is, because you have no varchar involved then SET DATEFORMAT or SET LANGUAGE settings do not apply.

    And because it’s SQL Server 2008, you can use the “date” type which has time part removed.

    Or have I misunderstood?


    You can use this format yyyymmdd because it is the “safe” format for SQL Server regardless of settings.

    See may answer here please: sql server datetime

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.