SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
SQL Guy 1
SQL Guy  1
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3424 Visits: 2592
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
paul.knibbs
paul.knibbs
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4064 Visits: 6240
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.
SQL Guy 1
SQL Guy  1
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3424 Visits: 2592
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search