After selecting the trace name and server we will want to specify some filters for our trace. The sproc I'm developing archives 6 tables in the database. Therefore I will want to filter the trace to only capture SQL executed against those tables. I open up "Trace Properties" click on the Filters tab. Then scroll down to the Text key and enter the following in the Include field: %<table 1 name>%;%<table 2 name>%;%<table nname>%;

Figure 2.     Trace Properties dialog filtering by table name

Then I save the trace definition. You will want to be cautious when filtering by table. If there was a primary key - foreign key relationship defined between one of the tables I included in the trace and another table I excluded I could encounter SQL errors when replaying my trace. In my case, there is no pk-fk constraint defined so I am safe. Now our trace will only capture SQL executed against the tables we entered above. After specifying the filter our trace is ready to be executed against the production server. However, we will want to keep in mind the time that my new sproc will run. In order to minimize load on the server it was decided to install the sproc at 12:00 AM. Since installation occurs at 12:00 AM we will want to ensure that our SQL trace captures activity on the production server during the same time. So we've waited around until midnight and now we can start the trace capture. We should let the trace run for at least the length of time that I estimate the new sproc will run which is, in this case, 5 hours. After 5 hours of running we stop the trace (click on the Red square) and save the trace file (select Save As-Trace File from the File menu).