【问题标题】:Using SQL Profiler to get the name of stored procedures使用 SQL Profiler 获取存储过程的名称
【发布时间】:2016-12-21 11:13:58
【问题描述】:

我有一个包含近千个存储过程的数据库(SQL server 2000),我想知道单击按钮后调用了哪个存储过程。 我尝试使用 SQL Profiler(8.0 版)来捕获存储过程的名称,但似乎无法直接从 SQL Profiler 获取名称。

tutorial 说我可以通过运行来获取存储过程名称:

Select name from sysobjects where id = <ObjectID>

我试过了,但 id 什么都不匹配。 如何获取存储过程的名称?

谢谢

【问题讨论】:

  • 谢谢,但大多数解决方案无法应用于 SQL Server 2000。
  • 在运行 SQL Server Profiler 之前,通过尽可能多地添加过滤器来限制跟踪。例如,提供您可以在kodyaz.com/sql-server-tools/… 找到的数据库名称或数据库 ID 添加其他条件...
  • @YHTsai 点击的按钮在哪里?什么应用?什么类型的“按钮”?

标签: sql-server stored-procedures sql-server-2000 sql-server-profiler


【解决方案1】:

这个小查询可以为您提供数据库 T-SQL 代码(过程、函数、触发器等)的预览(前 8000 个字符):

select o.id
    ,case 
        when parent_obj = 0
            then ''
            else '[' + Object_Name(parent_obj) + '].'
     end + o.Name as Name
    ,c.text
    ,xType as Type
from syscomments c
join sysobjects o on (o.id = c.id)
where ColId = 1
    and Category = 0
order by o.xType
    ,name
    ,c.Colid

【讨论】:

    猜你喜欢
    • 2015-06-07
    • 2018-09-15
    • 1970-01-01
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 1970-01-01
    相关资源
    最近更新 更多