数据库中的存储过程列表 [英] List of stored procedures inside a database

查看:49
本文介绍了数据库中的存储过程列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了对我的数据库之一的正确调用数据(​​存储过程的参数不是发现)

I suffer the correct calling data to one of my databases (Parameter of stored procedure not found)

为了进一步调试,提取我的数据库中可用存储过程的列表以及调用每个过程的参数可能会有所帮助.

For further debugging it might be helpful to extract a list of available stored procedures inside my database and the params to call each procedure.

如何使用 Delphi 代码从数据库中获取这些信息?

How to get this information from the database using Delphi code?

  • 德尔福 XE 2
  • 数据库 SQL Server 2008
  • 请注意

推荐答案

以下查询将列出默认数据库中所有用户定义的存储过程(包括它们的参数和参数类型):

The following query will list all user defined stored procs (including their parameters and parameter types) in your default database:

SELECT
  sp.name,
  p.name AS Parameter,
  t.name AS [Type]
FROM
 sys.procedures sp
  LEFT JOIN sys.parameters p
    ON sp.object_id = p.object_id
  LEFT JOIN sys.types t
    ON p.system_type_id = t.system_type_id
WHERE 
  is_ms_shipped = 0 
ORDER BY
  sp.name

将其放入 ADOQuery 对象并将其设置为 Active.(使用 LEFT JOINS 更新了答案,使其包含不带参数的 SP).

Put that into an ADOQuery object and set it to Active. (Updated answer with LEFT JOINS so that it includes SPs without parameters).

这篇关于数据库中的存储过程列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆