在文本框中显示存储过程 [英] Displaying stored procedure in textbox

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

问题描述

在我的项目中,我必须显示服务器上所有数据库名称的列表,以完成此操作,然后我必须显示特定数据库的所有存储过程,以完成此操作.我仍然需要做的是将存储的过程显示在Windows窗体的文本框中.不是存储过程的结果,也不是存储过程的名称,而是实际的存储过程,创建过程以及从表中选择*等.

请帮忙.

如果您认为我需要澄清一点,请询问,我将相应地进行澄清.

In my project i have to display a list of all database names on your server, ive done that, then i have to display all the stored procedures for a specific database, ive done that. what i still need to do is display the stored procedure into a textbox in windows forms. not the results of the stored procedure and not the name of the stored procedure, but the actual stored procedure, the create procedure and select * from table, etc.

please help.

if you think i need to clarify a bit more please ask and i will do so accordingly. thanks in advance.

推荐答案

sp_helptext ''dbo.name of sp''


在此链接中,他们有相同的问题,并且有很多解决方法吧!

simple-way-to-programmatically-get-all-stored-procedures [ ^ ]
in this link they have the same issue and a lot of way to solve it!

simple-way-to-programmatically-get-all-stored-procedures[^]


解决方案1是正确的,我在给你第二个示例,它将重新运行相同的结果

solution 1 is correct and i am giving you second example which will retrun same result

select routine_definition
from INFORMATION_SCHEMA.routines
where specific_catalog = 'databaseName'
and specific_schema = 'dbo'
and routine_type = 'Procedure'
and routine_name = 'ProcedureName'



在解决方案1中,只要存储过程长,它就会给您多行,但在此解决方案中,它只会返回您一行. 现在,我给您另一个查询,它将返回相同的结果.



in solution 1 it will give you many row as long as storeprocedure but in this solution it will return you only one row.
now i am giving you a another query which will return same result.

select definition
from sys.sql_modules
where object_id = object_id('databaseName.dbo.ProcedureName')


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

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