Search code examples
sqlsql-serverdatedatetime

Select between dates on DD.MM.YYYY format?


How can I select all rows between two dates, where the dateformat is DD.MM.YYYY?

For example between 15.12.2013 and 25.12.2013


Solution

  • As Gordon and the Horse have commented, you should seriously consider storing your dates as a date type and not as text. That being said, you can convert your date column to a datetime using SQL Server's CONVERT() function and then compare that against the date range.

    SELECT *
    FROM yourTable
    WHERE CONVERT(datetime, date_col, 104) BETWEEN '2013-12-15' AND '2013-12-25'