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

Server side trace to a table Expand / Collapse
Author
Message
Posted Wednesday, January 11, 2012 8:58 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, May 15, 2013 6:26 PM
Points: 263, Visits: 866
The link below helps me to create a server side trace to a file. I'd like to send the results to a table. Could some please tell me what change I need to make in the script to send the results out to a table?
http://sqlserverpedia.com/wiki/The_Server-side_Trace:_What,_Why,_and_How

And also, I was told that server side tracing to a table in SQL 2000/2005 is different from SQL 2008. Is it?
Post #1234070
Posted Wednesday, January 11, 2012 9:47 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 17, 2013 12:22 PM
Points: 10,571, Visits: 11,871
You can't write directly to a table with a server-side trace. Even if you could it wouldn't be wise as it would not perform as well as writing to a file and would have a negative impact on overall server performance.

You get read the trace file using fn_trace_gettable([path to file]) and use that to load the trace data into a table if you want to do that.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1234143
Posted Wednesday, January 11, 2012 1:19 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 10:29 AM
Points: 5,201, Visits: 11,154
Using fn_trace_gettable you'll need to supply the file and path and the number of files to read. As below

Load 10 files

select * into my_trace 
from fn_trace_gettable('c:\mypath\mytrace.trc', 10)


Load all files

select * into my_trace 
from fn_trace_gettable('c:\mypath\mytrace.trc', default)



-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #1234328
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse