Introduction
I will explain How to Use of Cursor to Print All Stored Procedures of Database.
Example
Just give this script a try and it will print
text of all the SP in your database. If you are using Grid View for
Result Pan I suggest to change it to Text View (CTRL+T) to read the text
easily.
I will explain How to Use of Cursor to Print All Stored Procedures of Database.
Example
USE gohil
GO
DECLARE @procName
VARCHAR(100)
DECLARE @getprocName CURSOR
SET @getprocName = CURSOR FOR
SELECT s.name FROM sysobjects s
WHERE type = 'P'
OPEN @getprocName
FETCH NEXT
FROM @getprocName
INTO @procName
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_HelpText
@procName
FETCH NEXT
FROM @getprocName
INTO @procName
END
CLOSE @getprocName
DEALLOCATE @getprocName
GO
|
0 comments :
Post a Comment