Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to script profiler trace to save results to a table ? Expand / Collapse
Author
Message
Posted Wednesday, February 20, 2013 10:16 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 8:00 AM
Points: 432, Visits: 1,344
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
Post #1422186
Posted Thursday, February 21, 2013 9:44 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:12 AM
Points: 1,610, Visits: 5,482
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.
Post #1422678
Posted Thursday, February 21, 2013 10:13 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 8:00 AM
Points: 432, Visits: 1,344
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.
Post #1422695
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse