First, check if you really need that space in the REPLACE function. I would think it should be one of these:WHEN q.Q_DriversAssigned LIKE '%st %' THEN CAST(REPLACE(q.Q_RemovalCharge,'st ','') as DateTime)WHEN q.Q_DriversAssigned LIKE '%st%' THEN CAST(REPLACE(q.Q_RemovalCharge,'st','') as DateTime)
If that is not the issue then there are some strings in the Q_RemovalCharge column that are not in the proper format that allows SQL Server to convert them to datetime data type. You can get an idea of what those are by running this query:SELECT REPLACE(q.Q_RemovalCharge,'st ','')FROM o.TblQuotation AS qWHERE q.Q_DriversAssigned LIKE '%st%'AND ISDATE(REPLACE(q.Q_RemovalCharge,'st ',''))=0