As we know that dynamic SQL should always be executed using sp_executesql” so that it can reuse the execution plan from cache. I believe you aware of this. Here is my question, how SQL Server can identify plan from cache in-case of dynamic SQL?We know t

Started by Ziyad, November 26, 2016, 07:24:21 AM

Previous topic - Next topic

Oskar

Hi all, I'd like to ask you a little problem, I hope you'll answer me, as we know that dynamic sql should always be executed using “sp_executesql” so that it can reuse the execution plan from cache. i believe you aware of this. here is my question, how sql server can identify plan from cache in-case of dynamic sql? we know that stored procedure can be identified by its name in the cache but how this dynamic sql submitted through sp_executesql is identified from cache? Please kindly give me your help quickly.