set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go-- =============================================
-- Author: 高利军
-- Create date: 2011-06-08
-- Description: 获取所有存储过程源码
-- =============================================
ALTER PROCEDURE [dbo].[sp_getAllProcText]
-- Add the parameters for the stored procedure here
AS
SET XACT_ABORT ON
BEGIN TRANSACTION
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
SET NOCOUNT ON;
declare @proc_text varchar(max)
DECLARE get_proc_text_cursor CURSOR FOR
SELECT 'IF OBJECT_ID(N'''+ [name] +''') IS NOT NULL '+ CHAR(10) + CHAR(13) +' DROP PROC ' + [name] + CHAR(10) + CHAR(13) + ' GO ' + CHAR(10) + CHAR(13) + definition + CHAR(10) + CHAR(13) +' GO'
FROM sys.sql_modules
inner join sysobjects on sys.sql_modules.object_id = sysobjects.id and type='p'
OPEN get_proc_text_cursor
FETCH NEXT FROM get_proc_text_cursor
INTO @proc_text
WHILE @@FETCH_STATUS = 0
BEGIN
--UPDATE tb_HQ_Out_Order SET state = 0 WHERE hoor_code = @hoor_code
print @proc_text
FETCH NEXT FROM get_proc_text_cursor
INTO @proc_text
END
CLOSE get_proc_text_cursor
DEALLOCATE get_proc_text_cursor
END
COMMIT TRANSACTION