简体   繁体   English

如何从 Sql 查询中向 SQL 分析器写入消息?

[英]How can I write a message to SQL profiler from Sql a query?

I am troubleshooting for some SQL issue and I use SQL Profiler in order to diagnose some problem.我正在对一些 SQL 问题进行故障排除,我使用 SQL Profiler 来诊断一些问题。

Is it possible to write some messages into SQL Profiler by adding some lines in a TSQL query?是否可以通过在 TSQL 查询中添加一些行来将一些消息写入 SQL Profiler?

thanks!谢谢!

you can do by adding comment to your t-sql like你可以通过向你的 t-sql 添加评论来做到这一点

 -- My message
select * from table1

and send all to sql并将所有内容发送到 sql

The Application Name should also be different.应用程序名称也应该不同。 For our installation, activity on the website gives an application name of ".Net SqlClient Data Provider", while queries from SQL Server Management Studio are designated as... well... "SQL Server Management Studio"对于我们的安装,网站上的活动给出了一个应用程序名称“.Net SqlClient Data Provider”,而来自 SQL Server Management Studio 的查询被指定为......好吧......“SQL Server Management Studio”

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

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