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
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