Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Scripted traces

Author  Topic 

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-12-12 : 16:21:02
Has anyone had any luck with the scripted traces you can generate using Profiler using the sp_trace_create and sp_trace_setstatus? I can run them but it doesn't generate any output. Has anyone done this successfully?

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-12-12 : 16:44:37
Are you making sure you stop and close the trace before trying to view it.
Assuming a traceid of 1 then you would need to issue
exec sp_trace_setstatus 1,0 --Stop trace
exec sp_trace_setstatus 1,2 --Close trace



You need to do both before trying to view the trace file otherwise you will get an error stating that
the trace file contains no data and the file size is 0 bytes - is that the problem ?
Just stopping the trace won't allow you to view the data.


HTH
Jasper Smith

Edited by - jasper_smith on 12/12/2002 16:50:00
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-12-12 : 17:30:27
This is the reason I'm really, really glad I started this site. "Close the trace." Who would've thought. I'm sure that was buried in the Books Online stuff I read but I sure didn't catch it. Thanks man!

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-12-12 : 17:37:38
Glad to be of service
It doesn't appear to be in BOL at all actually. It mentions having to stop the trace before you can close it but not having to close it and delete its definition before viewing the output. I will send some feedback to the BOL team.
Go to Top of Page
   

- Advertisement -