SELECT *
FROM MyTable
WHERE SUBSTRING(CAST(Date_of_contract AS varchar(38)), 1, 4) = 2017
But all I get is this error:
Conversion failed when converting the varchar value 'Oct ' to data type int.
Datatype for Date_of_contract column is datetime