• Your original code:

    create table #temp (ID int, Name varchar(20))

    insert into #temp

    values

    (10, 'Helen'),

    (20, 'Joe'),

    (30, 'Blake');

    ;with cte as

    (select * from #temp)

    select * from cte

    union all

    ;with cte as -- << error is here

    (select * from #temp)

    select * from cte

    The error message:

    Msg 102, Level 15, State 1, Line 12

    Incorrect syntax near ';'.

    If you double click on the error message in the messages tab it takes you directly to the error.

    Also, CTE's do not start with a semicolon. The semicolon is a statement terminiator not a statement begininator.