• We figured you were using SQL 2008 since you posted in a SQL 2008 forum.

    I believe CTEs were introduced in SQL 2005. Sorry, but I don't have a SQL 2000 instance to play around with.

    You should be able to use the same approach using a tally table instead of the CTEs. Please read http://www.sqlservercentral.com/articles/T-SQL/62867/ for Jeff's article on how to do it.