please find the converted code belowDELETE FROM DBO.employees WHERE transaction_id IN( SELECT transaction_id FROM employees sf, calendar_chart cd WHERE cd.calendar_chart = sf.date_id AND cd.calendar_date > CONVERT(DATETIME, '05-JAN-2012') AND RTRIM(LTRIM(trade_type)) = 'C' AND RTRIM(LTRIM(trans_cd))+ '~'+ RTRIM(LTRIM(trans_suffix)) <> '001~021' AND EXISTS ( SELECT 1 FROM department_history WHERE RTRIM(LTRIM(order_no)) = RTRIM(LTRIM(sf.order_no)) AND RTRIM(LTRIM(trans_cd)) + '~' + RTRIM(LTRIM(trans_suffix)) = '001~021' AND RTRIM(LTRIM(trade_type)) = 'A' ));
Regards,Alwyn.M