March 23, 2016 at 4:19 pm
Is there a way to schedule a sql trace through script and have it write directly to a table?
March 23, 2016 at 8:54 pm
Yes you can ..Google "Server side tracing in SQL Server".Place the trace script in a SQL job and schedule it and using fn_trace_gettable read the trace file to insert the trace data in the table.
--------------------------------------------------------------------------------------------------
I am just an another naive wannabe DBA trying to learn SQL Server
March 23, 2016 at 9:42 pm
Sachin Nandanwar (3/23/2016)
Yes you can ..Google "Server side tracing in SQL Server".Place the trace script in a SQL job and schedule it and using fn_trace_gettable read the trace file to insert the trace data in the table.
I do understand that, my question was when i schedule a trace , can i directly write it to a trace.
March 24, 2016 at 4:06 am
No you can't. Writing directly to a table is a feature of the Profiler GUI (and is usually a bad idea, especially if writing to the instance being traced)
Schedule your trace to write to a file, afterwards import the trace with the fn_trace_getdata function. If you want, you can schedule that part too.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply