您的位置:首页 > 数据库

从 syscomments 取系统存储过程、用户存储过程、视图、函数、触发器等对象的sql定义语句

2010-05-14 11:21 961 查看
/*
select * from sysobjects
where xtype='fn'

sp_helptext [sp_helptext]
*/

declare @sql nvarchar(4000)

declare cur_GetSql cursor for
select a.text
from syscomments a inner join sysobjects b on a.id=b.id
where b.name='sp_help'

open cur_GetSql

fetch next from cur_GetSql into @sql
while (@@fetch_status = 0)
begin
print @Sql
fetch next from cur_GetSql into @sql
end

close cur_GetSql
deallocate cur_GetSql
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐