tombiagioni1983 (5/11/2014)
If there is a better method of implementation, please share it with me.
There's is indeed. See Luis' code, which he previously posted. Remember that CROSS APPLY is akin to "For Each Row".
--Jeff Moden
Change is inevitable... Change for the better is not.