How to script profiler trace to save results to a table ?

  • Hi all,

    I created a trace in Profiler GUI. I set it to save results to a table and it is working good.

    But if I script trace definition, it does not provide anything to save it to table. System procedure sp_trace_create has only option to save to a file.

    Is it possible to save it to table at all with script or I am missing something? My version is 2008 R2.

    Thanks

  • I don't think you *can* do it directly to a table, no--you have to use the fn_trace_gettable function to copy the trace file into a table.

  • Thanks for advise, I did not know about this function.

    So it sound like I have to create a job which on periodical basis will call this function and load trace file contents into a table, with specifying the last trace RowNumber from the table in order not to get duplicates.

    Not a perfect solution, but so far I could not find better one.

    Thanks again.

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

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