Eirikur Eiriksson (5/7/2014)
You are missing the increment of the counter, the code never hits it, improved code below😎
BEGIN and END, your best friends in TSQL 🙂
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP