How to: Create a Transact-SQL Script for Running a Trace (SQL Server Profiler)
This topic describes how to create a Transact-SQL script from an existing trace file or table by using SQL Server Profiler.
To create a Transact-SQL script to run a trace
On theFilemenu, point to Export, point to Script Trace Definition, and then click For SQL Server 2005, For SQL Server 2000, or For Analysis Services 2005, depending on the server that is to be traced.
In the Save As dialog box, enter a name for the script file, and then click Save.