Converting varchar to date for range SQL

250 views Asked by At

I am trying to convert from a varchar field in TSQL to Date -

The error I'm getting is conversion of varchar to date in US m/d/y mm/dd/yy format resulted in an index out of range

This is my query

select *
from test_revision2
where test_revision2.location ='Downsview' AND
      not exists (select 1
                  from test_bookings2
                  WHERE ((CONVERT(DateTime, startDate, 103) <= CONVERT(DateTime, '11/31/2017 00:00:01', 103)) 
AND (CONVERT(DateTime, endDate, 103) >= CONVERT(DateTime, '11/30/2017 00:00:01', 103))  and
                        test_bookings2.wsid = test_revision2.wsid));
0

There are 0 answers