--SQL中不支持参数视图,改函数:create function f_qry(@parentid int)
returns table
as
return(SELECT (select count(*) from xtree where xtree.parentid=x.id) AS children, *
FROM xtree AS x
WHERE parentid=[@parentid])