zoukankan      html  css  js  c++  java
  • (4.27)查看存储过程中的依赖关系

    关键词:查看存储过程中引用的表,查看表在哪些存储过程中出现过

    很多时候需要找到存储过程所依赖的对象。博客描述了一种在SQL服务器中查找存储过程依赖关系的方法。

    以下查询创建存储过程。

    以下查询列出了usp_getpersonaddress过程所依赖的所有对象。

    上述查询的输出如下所示。

        在sql server中查找存储过程的依赖关系

    2、查看与表相关的存储过程

      

    SELECT DISTINCT objects.name, objects.type,
    comments.text proc_defintion
    FROM syscomments comments
    INNER JOIN sys.objects objects 
    ON comments.id=objects.object_id
    WHERE comments.text LIKE '%Person.Address%'
    AND objects.type='P'

    3、查看与列相关的存储过程

    -- find stored procedure related to a column in database
    SELECT DISTINCT objects.name, objects.type,
    comments.text proc_defintion
    FROM syscomments comments
    INNER JOIN sys.objects objects 
    ON comments.id=objects.object_id
    WHERE comments.text LIKE '%AddressID%'
    AND objects.type='P'
  • 相关阅读:
    MS SQL Server备份与恢复实例
    如何加快查询,优化数据库
    使用索引的误区之一:没有使用复合索引的前导列导致查询不使用索引
    URL重写可删节日期模式正则表达式之强力应用
    索引全攻略
    大数据量分页存储过程效率测试附代码
    形成查询结果(实体框架) 使用导航属性导航关系
    C#开源资源大汇总
    大数据量的系统的数据库结构如何设计?
    数据库查询优化
  • 原文地址:https://www.cnblogs.com/gered/p/10650419.html
Copyright © 2011-2022 走看看