I am converting mysql to sql query, i did many changes for that to run query in sql server, but still i am getting error Incorrect syntax near the keyword 'as'., can anyone please help me why i am getting this error ? Here is my query for that
UPDATE tb_EpVisitRange as v
left JOIN tb_Episode as e
ON v.BranchID = e.BranchID
AND v.company_id = e.CustID
AND v.CMW = e.CMW
SET
e.EpVisitCount = IIF(PayerType = 'NonEp', 0, IIF(LUPA = 1, 0, v.High)),
e.VisitAlert = IIF(Status = 'Closed', 0, IIF((IIF(PayerType = 'NonEp', 0, IIF(LUPA = 1, 0, v.High))) > 0, 1, 0))
where billed_flag = '0';