views:

24

answers:

2

Hi All,

I am building and executing some dynamic sql and wanted to use SQL Server profiler to view that execution statement. Do you know what filters /settings I have to use in order to see that? I have looked through them and could be just looking right over the obvious setting.

EDIT:

The dynamic sql is called within a procedure.

Thanks in Advance,

--S

A: 

Take a look at the SQL:BatchCompleted event in the TSQL category and make sure you have the TextData column checked/shown. The Standard (default) template includes these already.

Daniel Renshaw
Thanks Daniel the dynamic sql is called within a procedure. Does that change the config?
scarpacci
I'm not sure; it might work if you're `sp_executesql` or `EXEC` ing some SQL but if it doesn't try turning on the `SQL:StmtCompleted` event too.
Daniel Renshaw
+1  A: 

Following your edit you would need either the SP:StmtCompleted or SP:StmtStarting events (You can find these in the "Stored Procedures" section).

This might collect quite a lot of data so apply appropriate filters.

Martin Smith
that did it thanks
scarpacci