question

rehaan avatar image
rehaan asked

Profiler

I want to capture all TSQL statements for a particular user. How can i do this using Profiler ? can someone help me please?
stored-proceduresprofiler
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Oleg avatar image
Oleg answered
Open the profiler via **Tools** -> **SQL Server Profiler** menu in SSMS. Open New Trace window. There you can select which events you would like to capture. For example, the screenshot below shows that TSQL -> SQL:BatchCompleted is included (among other events, your choice): ![Events selection][1] In order to capture the events only for a specific login, click the Column filters button to open **Edit filter** dialog: ![Column filters][2] There, you can add the filter for the specific login name. When all is done, please click the Run button to start the trace. Please note that this will use some resources, and therefore, don't forget to stop the trace when you are done auditing. Hope this helps. Oleg [1]: /storage/temp/4511-trace-events.png [2]: /storage/temp/4512-trace-columns.png

trace-columns.png (10.6 KiB)
trace-events.png (24.6 KiB)
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Usman Butt avatar image Usman Butt commented ·
@rehaan You should explore Extended events as well.
1 Like 1 ·
Usman Butt avatar image Usman Butt commented ·
@Oleg It is Friday indeed :) But on a serious note, you are really helpful.
0 Likes 0 ·
LadyProgrammer avatar image LadyProgrammer commented ·
The explanation with screenshots is awesome!
0 Likes 0 ·
rehaan avatar image rehaan commented ·
@oleg Thank you so much for your help. This was what i needed exactly.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.