以下是引用唐尸三摆手在2010-4-18 15:31:00的发言:
这样测试了一下:
dim al as string="B-WG-XJ-DG-53"
'多级反展
Dim s As String = " ;with cte As " & _
"(select * from abt00000 where childitem = '" & al & "' " & _
"union all " & _
"select a.* from abt00000 a " & _
"join cte on a.childitem = cte.parentitem) " & _
"select * from cte "
output.show(s)
显示结果为:
;with cte As (select * from abt00000 where childitem = 'B-WG-XJ-DG-53' union all select a.* from abt00000 a join cte on a.childitem = cte.parentitem) select * from cte
然后拷入查询管理器中:执行到2分30秒还没显示结果
可是为什么正展在瞬间就显示结果呢?
[此贴子已经被作者于2010-4-18 15:34:27编辑过]
应该索引的原因。parentitem列没有加索引。
可以把abt00000 只留部分实例数据 然后备个份发给我。看到结构才能分析原因。