There is some way to implement a infinite loop in SQL?? I was thinking on some like a select inside another one, recursively... (Maybe im talking foolishness)
You can do a recursive infinite loop with a CTE:
;with rec as
(
select 1 as n
union all
select n + 1
from rec
)
select n
from rec
By default, SQL Server would stop at 100; you can make it loop forever with:
option (maxrecursion 0)
WHILE 1=1
BEGIN
SELECT 'This will go forever'
END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With