I've looked around for a solution for this, but none of them seem to fix my problem
SELECT TOP 10 [Appointment_Date]
FROM dbo.RF_Performance_Referrals_Main
WHERE (([Appointment_Date]) < '7/21/2014')
ORDER BY [Appointment_Date] DESC
Above is the Simplified version of the query I am trying to. I keep get an error
[Microsoft][ODBC SQL Server Driver][SQL Server]Then Conversion of a varchar datatype to a datetime data type resulted in an out of range value
I thought maybe there is a problem with my connection...
so I tried it on Excel and got the exact same error...
I checked the SQL Server table that particular field is set to DATETIME
So why is it giving an error?
I tried all sorts of stuff on Cast/Convert, but none of them seem to work i still get the same error. I don't really get why.
Please help if fix this.
Thanks a lot in advance
code
SELECT TOP 10 [Appointment_Date] FROM dbo.RF_Performance_Referrals_Main WHERE ([Appointment_Date] < '7/21/2014 00:00:00') ORDER BY [Appointment_Date] DESC Tried what you said... Same Error.. it used to work brilliantly till someone higher up decided they wanted to merge prev & future appointments. I am going to try reading through the second link. This problem is really affecting the department we can't see who requires and urgent appointment >_< and the Information Team that made this table don't have a clue why either it's been 3-4 weeks they are still trying to sort it out T_T