Script Profiler Session

  • Hi all,

    I'm setting up some profiling to help out some developers, the basic idea is that a job will fire at 9am, and basically record all activity on the development that the developers make from specific ip address, then at 5.30pm a job will fire to stop the trace.

    All pretty straight forward, I've created my trace in profiler and scripted it off, however the script attempts to write the trace data to file not to my table. Is it possible to script the profiler so it will write to the table, not a file?

    The generated script says in it "-- Writing to a table is not supported through the SP's". Does anyone have a work around or alternative?

    Thanks.

  • The way I've always done this is to make the last step of the script that stops the trace, load the trace file into a table using fn_trace_gettable, e.g.:-

    SELECT * INTO mytracetable

    FROM fn_trace_gettable('c:\mytracefile', default)

  • You can use the function fn_trace_gettable in order to insert the data from the trace’s files into table. You can look in BOL (Books On Line the help file that is installed with SQL Server’s client tools) for more information abount fn_trace_gettable

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply