Hello,
Looks like the code works outside the stored proc. It could be a SQL 2012 issue, not sure. As for dropping the temp table, I still think it good to drop it anyway but that my preferance 🙂
I'll play a bit more later next week.
Thanks,
Rudy
Rudy