By default, SQL Server Profiler traces all coming Stored Procedures or SQL Commands are submitted to your SQL Server. Therefore, you may in trouble if the server is hosting many databases with difference database usernames. It’s hard for you to trace a desired event because other events from difference databases keep logging. Fortunately, SQL Server Profiler allow you to filter events just from a specific database or a specific login username.
In order to limit SQL Server Profiler tracing to a specific database or username, simply follow these steps below:
- 1. Create a New Trace and login to a server which you want to set the limitation
- 2. On Trace Properties, click on Events Selection tab then check on Show all columns checkbox
- 3. Click on Column Filters … button, under the Show all columns checkbox
- 4. You should see DatabaseName and LoginName in the Edit Filter box, enter the database name or login name for the Like section on the right then click OK button.
- 5. You will be sent back to Trace Properties box, click Run button then you will see the trace panel is only for the database or login name you have entered on step 4.
Of course, you can do filter with others options with Like or Not like condition. DatabaseName and LoginName are 2 options I often use most.