Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get T-SQL PRINT statements to come up in SQL Server Profiler Traces?

I'm not very experienced with SQL Server Profiler (2005, 2008). I'd like to print some info to a trace from a stored procedure. PRINT statements don't seem to output to my trace. How can I easily get the PRINT statements to output to the trace?

If that's not what trace (or PRINT) is really meant for, what's a quick easy alternative?

like image 799
srmark Avatar asked Oct 01 '09 01:10

srmark


People also ask

Which of the following is used to show the Trace report in SQL?

Explanation: SQL Server Profiler is a rich interface to create and manage traces and analyze and replay trace results.


1 Answers

You could use sp_trace_generateevent to "fire" an event out to your SQL trace. There's an example of it on the BOL page for the proc: http://msdn.microsoft.com/en-us/library/ms177548.aspx

like image 67
Aaron Alton Avatar answered Sep 21 '22 15:09

Aaron Alton