Please, can someone tell me what is wrong in the code below?
I am just starting to learn SQL, (by myself) and need some guidance... Thank you.
I get this error messages:
Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'IF'.
Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'CASE'.
I am just starting to learn SQL, (by myself) and need some guidance... Thank you.
I get this error messages:
Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'IF'.
Server: Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'CASE'.
Code:
SELECT dbo.MAP_IDerrors_DemogMatch.*, dbo.StudentsID_Src.ID_Number AS StID
FROM dbo.StudentsID_Src INNER JOIN
dbo.MAP_IDerrors_DemogMatch ON dbo.StudentsID_Src.SetID = dbo.MAP_IDerrors_DemogMatch.SetID
WHERE dbo.StudentsID_Src.ID_Number = IF (len(idno) = 9) CASE len(old_id_number) WHEN 5 THEN concat('00', old_id_number) WHEN 6 THEN concat('0',
old_id_number) ELSE CASE len(idno) WHEN 5 THEN concat('00', idno) WHEN 6 THEN concat('0', idno)