Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursive With 1

Status
Not open for further replies.

dobe1

Technical User
Jun 28, 2004
65
0
0
US
Hi,
I'm trying to use the following code, which a sample I found is "SQL Cookbook" by Anthony Molinaro.

with x (cname,ccust#)
as (
select cast(cname as varchar(100)), ccust#
from cust_table
where cmstc# = 0
union all
select cast(x.cname + ' - ' + e.cname as varchar(100)),
e.ccust#
from ccust# e, x
where e.cmstc# = x.ccust#
)
select cname as cust_tree
from x
order by 1

I'm getting a error, and I wondering if this code can be run in SQL Server 2000 or is the "recusrive with" a SQL Server 2005 addition.

Thanks

Dobe
 
SQL Server 2005 only.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
This is a function which is new to SQL 2005.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top