August 21, 2012 at 10:32 am
Is there a way to save a sql server 2008 trace as a sql statement?
August 21, 2012 at 10:46 am
Do you mean a script of the code that creates the trade?
August 21, 2012 at 10:51 am
nah. when i build a trace to say return everything w reads over 1000 i was hoping the trace had an export script to sql and maybe it would show me the sql used behind the scenes for the trace
August 21, 2012 at 11:00 am
BaldingLoopMan (8/21/2012)
nah. when i build a trace to say return everything w reads over 1000 i was hoping the trace had an export script to sql and maybe it would show me the sql used behind the scenes for the trace
oh yeah I saw a while back there is no easy way to script out existing traces.
I threw an article out a few years ago, and the script has evolved a little bit since then:
Reverse Engineering a Server Side Trace[/url]
my best script to date can be found at this link here:
usage is super easy, it's simply exec sp_scriptAnyTrace 2, to script trace#2 for example; you might need to peek at sys.traces to get the traceid first.
i don't know if it's possible to update that article, the script is quite a bit better than what i wrote two years ago.
Lowell
August 21, 2012 at 11:14 am
If you're runnign the trace from Profiler, stop the trace, file > export > script trace definition.
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
August 21, 2012 at 4:04 pm
GilaMonster (8/21/2012)
If you're runnign the trace from Profiler, stop the trace, file > export > script trace definition.
That's what I'd do. I'd use Profiler to set up the trace, then script it and run as Server side.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply