Subject | Conversion Error in Recursive Query |
---|---|
Author | Ronan van Riet |
Post date | 2013-06-21T13:47:06Z |
Hello.
I could use some help with understanding why my query returns a partial record set and a conversion error from string "102".
SQL Message: -413
Engine code: 335544334
FlameRobin tells me myRecursive_VW has the following columns:
- ID Bigint
- PAR_ID Bigint
- NAME varchar(255)
I am using the following test to confirm the ID and PAR_ID are indeed integers.
SELECT a.ID+2, a.PAR_ID+2, a.NAME
FROM MYRECURSIVE_VW a
This test passed.
I also created a procedure and have the code run against that instead of my view. Same result.
I do not see where the conversion is happening. Any pointers?
WITH RECURSIVE myCTEName (id,level,top_key,par_id,name)
as (
select id
, 0 as level
, id as top_key
, null as immediate_parent_key, name
from myRecursive_VW
where par_id is null
UNION ALL
select chd.id,par.level+1,par.top_key,chd.par_id, name
FROM myCTEName par
JOIN myRecursive_VW chd
ON chd.par_id = par.id
)
select * from myCTEName
Best regards.
[Non-text portions of this message have been removed]
I could use some help with understanding why my query returns a partial record set and a conversion error from string "102".
SQL Message: -413
Engine code: 335544334
FlameRobin tells me myRecursive_VW has the following columns:
- ID Bigint
- PAR_ID Bigint
- NAME varchar(255)
I am using the following test to confirm the ID and PAR_ID are indeed integers.
SELECT a.ID+2, a.PAR_ID+2, a.NAME
FROM MYRECURSIVE_VW a
This test passed.
I also created a procedure and have the code run against that instead of my view. Same result.
I do not see where the conversion is happening. Any pointers?
WITH RECURSIVE myCTEName (id,level,top_key,par_id,name)
as (
select id
, 0 as level
, id as top_key
, null as immediate_parent_key, name
from myRecursive_VW
where par_id is null
UNION ALL
select chd.id,par.level+1,par.top_key,chd.par_id, name
FROM myCTEName par
JOIN myRecursive_VW chd
ON chd.par_id = par.id
)
select * from myCTEName
Best regards.
[Non-text portions of this message have been removed]