sp_executesql In Loop Taking FOREVER to Run. Slowing down as it runs. Memory Leak?
Long and short is that my query is taking FOREVER to run and I think it has to do with the sp_executesql queries. Yes, there are loops, and yes I am using Dynamic SQL. No, I do not really understand CTEs and can never get them to work, or worse I use one someone suggested and then I break it later and I don’t understand it well enough to fix it. So here we are.
sp_executesql Not Returning Correct Value Using OUTPUT
I usually don’t use parameters for the sp_executesql, but I am trying to be better. I think I do not have something set up correctly for this one.