生成存储过程脚本.sql
来自「sqlserver 数据库编程的绝好脚本」· SQL 代码 · 共 24 行
SQL
24 行
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_out_put
drop table ##
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?