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

  • Creating table with T-SQL - can't see created tables in Object explorer
  • How can I solve a connection pool problem between ASP.NET and SQL Server?
  • The multi-part identifier could not be bound in ms sql server database
  • How to call C# function in stored procedure
  • How to create a loop for columns with (yyyy-mm-dd) format?
  • I need to return the Max count of repeating values in a consecutive data set based on dates
  • 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.

  • SQL query to fetch the data from two tables with “not in” condition
  • What does varchar(-1) mean?
  • “Must declare the table variable ”@name“” in stored procedure
  • How to add table column headings to sql select statement
  • How to dynamically declare PARTITION RANGE IN Partition function in sql server
  • Database VIEW does not reflect the data in the underying TABLE
  • 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.