How to: Integrate SQL Trace Data

SQL tracing is a tool you can use in your load tests to help you monitor and improve the performance of your Web applications. You should use SQL tracing only if your Web application uses SQL Server to store data.


SQL tracing is not restricted to Web tests. Unit tests for applications that access SQL Server databases are also good candidates for SQL tracing.

You can collect SQL trace data during a load test to analyze later. You can enable SQL tracing only in the Load Test Editor. You cannot enable SQL tracing when you create the load test with the Load Test Wizard. For more information, see About SQL Tracing.


To use SQL tracing in a load test that is run locally on a computer that is running Windows Vista, you must be a member of the sysadmin role on the SQL Server instance that is being traced. To fix this problem, a SQL Server administrator must add you to the sysadmin role.

To enable SQL tracing for a load test run

  1. Open a load test in the Load Test Editor.

  2. Right-click the active Run Settings node for your load test and then click Properties.

    The Properties window is displayed.

  3. Set the SQL Tracing Enabled property. True indicates that SQL Tracing is enabled; False indicates that it is not.

  4. Set the SQL Tracing Connect String property. Type the connection string of the SQL server you want to monitor, or click the ellipsis button to open the Connection Properties dialog box.

  5. Set the SQL Tracing Directory property. Type a folder in which to store the SQL trace data. The path must be accessible to the SQL Server and the client that is running Visual Studio Team System Test Edition.

  6. Set the Minimum Duration of Traced SQL Operation property. Type a value for the minimum duration of traced queries. For example, 500 indicates that all queries that take longer than 500 are traced. The units are in milliseconds. For SQL Server 2005, the units are in microseconds.

  7. Save and run your test.

    You can view the SQL Tracing data only after your load test has completed. For more information, see How to: View SQL Trace Data from a Load Test Run.

See Also

Other Resources

Editing Load Tests

Analyzing Load Test Runs

Load Test Results Repository