Use cursor to print all stored procedure in your database as a text. Use the code below to get all your SP in current database.
USE MyDatabase
GO
DECLARE @proc_Name VARCHAR(100)
DECLARE @mySP_cursor CURSOR FOR
SELECT s.name FROM sysobjects s WHERE type = 'P'
OPEN @mySP_cursor
FETCH NEXT FROM @mySP_cursor INTO @proc_Name
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_HelpText @procName
FETCH NEXT FROM @mySP_cursor INTO @proc_Name
END
CLOSE @mySP_cursor
DEALLOCATE @mySP_cursor
GO
Happy coding... :)
Post Reference: Vikram Aristocratic Elfin Share
USE MyDatabase
GO
DECLARE @proc_Name VARCHAR(100)
DECLARE @mySP_cursor CURSOR FOR
SELECT s.name FROM sysobjects s WHERE type = 'P'
OPEN @mySP_cursor
FETCH NEXT FROM @mySP_cursor INTO @proc_Name
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_HelpText @procName
FETCH NEXT FROM @mySP_cursor INTO @proc_Name
END
CLOSE @mySP_cursor
DEALLOCATE @mySP_cursor
GO
Happy coding... :)
Post Reference: Vikram Aristocratic Elfin Share
No comments:
Post a Comment