Subject | CTE recursive WITH error |
---|---|
Author | giuliano@pellegriniparisi.eu |
Post date | 2008-05-01T14:05:20Z |
Hi all,
I use firebird 2.1 with Xp sp2.
I have a simple table (tree) with 3 columns "Id","father" and "Description".
The table is autoreference.
I would like to use the WITH for CTE recursive, but I have this error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
CTE 'RIC' has cyclic dependencies.
I have try to execute the all SQL Code WITH in SQL Server 2005 and
work successfully.
This is the SQL code:
WITH ric(id,father,description,depth,level)
AS
(
select id,
father,
cast(description as varchar(50)),
cast(id as varchar(50)),
0
from TREE
where tree.id=1
union all
select tree.id,
tree.father,
cast(Tree.Descritpion as varchar(50)),
cast(depth + '.' + cast(tree.id as varchar(10)) as varchar(20)),
Level+1
from TREE inner join ric
ON tree.father = ric.id
)
SELECT * from ric
I don't understand where is the problem...Firebird 2.1 support CTE recursive?
Another solutions?
Thanking in advance and sorry for my english.
Giuliano
I use firebird 2.1 with Xp sp2.
I have a simple table (tree) with 3 columns "Id","father" and "Description".
The table is autoreference.
I would like to use the WITH for CTE recursive, but I have this error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
CTE 'RIC' has cyclic dependencies.
I have try to execute the all SQL Code WITH in SQL Server 2005 and
work successfully.
This is the SQL code:
WITH ric(id,father,description,depth,level)
AS
(
select id,
father,
cast(description as varchar(50)),
cast(id as varchar(50)),
0
from TREE
where tree.id=1
union all
select tree.id,
tree.father,
cast(Tree.Descritpion as varchar(50)),
cast(depth + '.' + cast(tree.id as varchar(10)) as varchar(20)),
Level+1
from TREE inner join ric
ON tree.father = ric.id
)
SELECT * from ric
I don't understand where is the problem...Firebird 2.1 support CTE recursive?
Another solutions?
Thanking in advance and sorry for my english.
Giuliano