Can't see anything wrong.
Make sure that the statement before the CTE (if there is one) is terminated with a ;
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability