I have built a Common Table Expression that gives me the results I need and I would like to loop through the results to run other selects with each record.
Is it possible to create a cursor with the results of a CTE?
I can run the CTE then select the information from the table in a simple select statement after the CTE is established:
Select * from tmpCTE
but when I change the code to read:
Declare tmpCursor cursor for
Select * from tmpCTE
I receive an error:
Incorrect syntax near the keyword 'Declare'.
Thanks,
KFlasph
Is it possible to create a cursor with the results of a CTE?
I can run the CTE then select the information from the table in a simple select statement after the CTE is established:
Select * from tmpCTE
but when I change the code to read:
Declare tmpCursor cursor for
Select * from tmpCTE
I receive an error:
Incorrect syntax near the keyword 'Declare'.
Thanks,
KFlasph