如何在表值函数中使用recursive cte返回100多条记录 [英] how to use recursive cte in table valued function that return more than 100 records

查看:114
本文介绍了如何在表值函数中使用recursive cte返回100多条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi all,


i am trying to create a table valued  <u>SPLIT </u>function that uses CTE's recursive functionality to get records from the user parameters. the function is returning the values for parameter as expected if the parameter value (accounts) count is less than 100 and if the number of user parameter (accounts) are more than 100 then the function is failing and returning an error message: <b>maximum recursion 100 reached.</b>

If anyone can give a solution or a better method to implement the same logic is appreciated.

推荐答案

使用:

Use:
;WITH CTE AS
(
    --select
)
SELECT 
FROM CTE
OPTION (MAXRECURSION 0)  --here!





请参阅:使用common_table_expression(Transact-SQL) [ ^ ]


这篇关于如何在表值函数中使用recursive cte返回100多条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆