--delete  test.dbo.Table_1

--test.dbo.Table_1 是存需要导出存储过程的列表
declare @strColName as varchar(50)
Declare Cur_NewTable Cursor
 For
Select a from test.dbo.Table_1
Open Cur_NewTable
While 1 = 1
Begin
    Fetch Next From Cur_NewTable Into
       @strColName

    IF NOT (@@FETCH_STATUS = 0)
        Break
 Set @strColName=LTrim(@strColName)
    Set @strColName=RTrim(@strColName)
   print 'SET QUOTED_IDENTIFIER ON
  GO
  SET ANSI_NULLS ON
  GO'
   print 'if exists (select * from dbo.sysobjects where id = object_id(N''[dbo].['+@strColName+']'') and OBJECTPROPERTY(id, N''IsProcedure'') = 1)'
   print 'drop procedure [dbo].['+ @strColName +']'
   print 'go'
   EXEC Sp_HelpText @strColName
   print 'GO
  SET QUOTED_IDENTIFIER OFF
  GO
  SET ANSI_NULLS ON
  GO'
End
Close Cur_NewTable
DeAllocate Cur_NewTable

--EXEC Sp_HelpText 'sGetTxNo'

 posted on 2010-09-20 10:08  umen  阅读(318)  评论(0)    收藏  举报