I have simple SQL Server 2008 table that has a column ourdate of type date.
So I tried to apply between on the date values, but it doesn’t work and gives me an error.
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string
Code like this:
select *
from [ComplainsDb].dbo.dateTB
where ourdate between '2012-11-01' AND '2012-12-31';
You need to use a date string format that is safe for all language and regional settings.
The ISO-8601 format
YYYYMMDD(note: NO dashes!) works in all situations – try this: