• Maxim Picard (1/11/2011)


    Are you referencing cteGetNewVSOldGroup later in your script?

    That may be an issue as well, but if you try to hop a database and reference a CTE, you'll get that exact error.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning