日期:2014-05-17 浏览次数:20617 次
declare @var table ( t1 nvarchar(max))
declare @str varchar(max)
declare @proname varchar(max)
declare pro cursor for
select name from sys.objects where type='P' and is_ms_shipped<>1
open pro
fetch next from pro into @proname
while @@fetch_status=0
begin
set @str=''
delete from @var
insert into @var
exec('sp_helptext '+@proname+'')
select @str=@str+REPlACE(REPLACE(t1,'CREATE PR','ALTER PR'),'KIDDB','s04235db')+CHAR(10) from @var
print (@str)--使用时改成exec (@str)--自己先测试下
fetch next from pro into @proname
end
CLOSE pro
DEALLOCATE pro