ObjectName non populated for StmtStarting/Completed when dynamic SQL is invoked from sp_executesql. - by Erland Sommarskog

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


5
0
Sign in
to vote
ID 588077 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 8/21/2010 12:30:23 PM
Access Restriction Public

Description

If a user runs a piece of dynamic SQL with EXEC(), the ObjectName column will display "Dynamic SQL" for SP:StmtStarting, SP:StmtCompleted and the ShowPlan events. However, if the dynamic SQL is invoked from sp_executesql, the column is NULL for StmtStarting/Completed, whereas it still is "Dynamic SQL" for the Showplan events.

I realise that it can be difficult to distinquish between SQL statements injected by sp_executesql, and other SQL statements that comes from within the engine, like the SELECT statment queries, and the repro includes such an example. The Showplan event have Dynamic SQL here as well.

The reason this matter is that sqltrace (http://www.sommarskog.se/sqlutil/sqltrace.html) wants to map the Showplan event to the StmtCompleted event.
Sign in to post a comment.
Posted by Jan [MSFT] on 3/23/2011 at 1:19 PM
Hello Erland,

Thank you for submitting this suggestion, but given its priority relative to the many other items in our queue, it is unlikely that we will actually complete it. As such, we are closing this suggestion as “won’t fix”. If you feel that this is worth reconsidering, feel free to send a message and we will take another look.

Jan
SQL Engine
Posted by Mike [MSFT] on 9/3/2010 at 2:07 PM
Thanks for the report Erland, we'll investigate this behavior.

Regards,
Mike Wachal