Link to home
Start Free TrialLog in
Avatar of RIAS
RIASFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Sql Query Datatype

Hello,

SELECT Top 1  Ref ,[Date],Time,PatientName,Auth,DoctorClinic,Comments,FaxAuth,Title,FaxNumber,Attn
				FROM table1  WHERE ( DeleteRecord is null or DeleteRecord = 0)    AND [Date] >= '03/01/2017' and [Date] <= '13/01/2017' and Faxauth <>  'Yes' OR Faxauth IS not NULL

Open in new window


Results in

Msg 242, Level 16, State 3, Line 1
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
 
But,

SELECT Top 1  Ref ,[Date],Time,PatientName,Auth,DoctorClinic,Comments,FaxAuth,Title,FaxNumber,Attn
				FROM DIARY WHERE ( DeleteRecord is null or DeleteRecord = 0)    AND [Date] >= '03/01/2017' and Faxauth <>  'Yes' OR Faxauth IS not NULL

Open in new window


Works fine

Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RIAS

ASKER

Cheers