I want to use CTE with while loop. Is it possible
my code:
; with myCTE(a,b)
(
select .,. from abc
)
while exist (select * from mycet) -- causing issue
Please suggest some solution.
Regards, Anuprita
I want to use CTE with while loop. Is it possible
my code:
; with myCTE(a,b)
(
select .,. from abc
)
while exist (select * from mycet) -- causing issue
Please suggest some solution.
Regards, Anuprita
No, the documentation states:
A CTE must be followed by a single SELECT, INSERT, UPDATE, or DELETE statement that references some or all the CTE columns.
But you should use a set based approach instead of loops anyway. Apart from that, it is not clear what your query should return.