所有存儲過程

  select   id=identity(int),text=cast(  
  N'if   exists(select   *   from   sysobjects   where   id=object_id(N'  
  +quotename(name)+N')  
  drop   proc   '+quotename(name)+N'  
  GO'   as   nvarchar(4000))  
  into   ##   from   sysobjects  
  where   xtype='p'  
  and   status>=0    
  insert   ##(text)   select   text    
  from(  
  select   c.id,c.number,s1=0,c.text    
  from   sysobjects   o,syscomments   c  
  where   o.id=c.id  
  and   o.xtype='p'  
  and   o.status>=0  
  union   all    
  select   c.id,c.number,s1=1,'go'  
  from   sysobjects   o,syscomments   c  
  where   o.id=c.id  
  and   o.xtype='p'  
  and   o.status>=0  
  )a   order   by   id,number,s1    
  exec   master.dbo.xp_cmdshell   'bcp   "select   text   from   ##   order   by   id"   queryout   "c:\a.sql"   /T   /c',no_output  
  drop   table   ##
posted @ 2008-07-21 15:30  Nina  阅读(301)  评论(0编辑  收藏  举报