mercredi 4 août 2021

Incorrect Syntax Near 'IF' - SQL Query

Below I have screenshot of the snippet of code where I am getting an error related to an IF statement, the troublesome line is highlighted.

The if statement is attempting to drop the temp table if it exists, and do nothing if it does not.

Above the if statement is the last of several CTE's I defined, and below the if statement is where the temp table is defined.

Please let me know if you can help trouble shoot what is causing the error. I have done extensive googling but many websites show the exact same code being used with no problem such as here

enter image description here

If something is wrong with my question please do comment so I can learn how to improve, thank you!

Aucun commentaire:

Enregistrer un commentaire