• I am getting the following error messages when executing your query.

    Msg 102, Level 15, State 1, Line 18

    Incorrect syntax near '?'.

    Msg 156, Level 15, State 1, Line 26

    Incorrect syntax near the keyword 'as'.

    Msg 102, Level 15, State 1, Line 31

    Incorrect syntax near '?'.