如何在SQL Server Profiler跟踪中获取T-SQL PRINT语句? [英] How can I get T-SQL PRINT statements to come up in SQL Server Profiler Traces?
问题描述
我对SQL Server Profiler的使用经验不是很丰富(2005年,2008年)。我想将一些信息打印到存储过程的跟踪中。 PRINT语句似乎没有输出到我的跟踪记录中。如何轻松地将PRINT语句输出到跟踪?
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?
如果这不是跟踪(或PRINT)的真正含义,那么有什么快速简便的选择呢? / p>
If that's not what trace (or PRINT) is really meant for, what's a quick easy alternative?
推荐答案
您可以使用sp_trace_generateevent将事件触发到SQL跟踪中。在BOL页上有针对proc的示例: http:// msdn。 microsoft.com/en-us/library/ms177548.aspx
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
这篇关于如何在SQL Server Profiler跟踪中获取T-SQL PRINT语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!