Try the below query. It converts a string in
dd/mm/yyyy hh:mm:ss
format to
yyyy-mm-dd hh:mm:ss.000
DECLARE @DatetimeString VARCHAR(25) = '23/10/2016 10:12:12.000'
SELECT CONVERT(VARCHAR(24), CONVERT(DATETIME, @DatetimeString, 103), 121) Date
You get the result as
Date
2016-10-23 10:12:12.000
But still I am not very convinced in the way in which you are comparing the dates. Dates should be compared after converting both to datetime.