开发者

ASP VBscript get sql script of a stored procedure

With microsoft sql server manager i know how to get this problem solved, but on the hosting where i am trying to update a old ASP Vbscript website i dont have access to this manager. and my question is: Is possible from ASP VBscript environement to access a stored procedure sql script ? and to see what 开发者_如何学Pythonsql queries were used for this stored procedure ? I know how to show their names but also i am interested in their content to know what tables do not touch with my modifications.


Here's a nice little tutorial example

First, show all the stored procedures in the database:

SELECT * FROM sysobjects WHERE type = 'P' AND category = 0 ORDER BY name

Next, retrieve a stored procedure's contents :

SELECT text 
FROM syscomments 
WHERE id = (SELECT id FROM sysobjects WHERE name = '{0}') 
ORDER BY colid


You could run a query like this:

SELECT definition 
    FROM sys.sql_modules 
    WHERE object_id = OBJECT_ID('YourProcedureName')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜