简体   繁体   English

SQL Server Profiler在后台,数据保存到表中

[英]SQL server profiler in the background with data saved to table

I want to run sql server profiler in the background. 我想在后台运行sql server profiler。 I know you can use SQL Trace but I want the trace info saved in a table and not in a file, and as far as I know you can only save to a file using SQL Trace. 我知道您可以使用SQL跟踪,但是我希望跟踪信息保存在表中而不是文件中,据我所知,您只能使用SQL Trace保存到文件中。

What I am trying to do is leave sql trace running in the background and whenever an asp page generates a 500 error I send an email to the admin. 我想做的是让sql跟踪在后台运行,并且每当ASP页面生成500错误时,我都会向管理员发送电子邮件。 Among the IIS related info in the email, I also want to include the last 50 lines from the trace. 在电子邮件中与IIS相关的信息中,我还希望包括跟踪中的最后50行。 That is why I need the info in a table, so I can easily send it in the email. 这就是为什么我需要表格中的信息,因此可以轻松地通过电子邮件发送它。

You can use SQL Profiler (in 2005 / 2008) to save the results to a table by selecting the Save to table checkbox when creating the trace. 您可以使用SQL事件探查器(在2005/2008中)通过在创建跟踪时选中“ Save to table复选框来将结果Save to table

Note: Before proceeding you should read this article 注意:在继续之前,您应该阅读本文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM