Didn't quite follow the logic you are trying to implement - but the syntax error can be fixed as shown below. ANTYPE will not be null in #ANTYPE table because of the else clause in the case expression in the inner query, so the update statement does not really do anything. But then again, may be ANTYPE is not what you want to name the column from the case expression?SELECT Main.*,
(
SELECT TOP 1 f.ValueStr,
CASE
WHEN f.objectName = 'Anesthesia_Type!Anesthesia_Post_Note'
THEN f.ValueStr
ELSE 'N/A'
END AS ANTYPE
FROM BVFindings f
WHERE f.sessionid = Main.sessionID
) AS ANTYPE INTO #ANTYPE
FROM @main Main
UPDATE #ANTYPE
SET ANTYPE = 'N/N'
FROM #ANTYPE
WHERE ANTYPE IS NULL
SELECT *
FROM #ANTYPE