无风kiseki

博客园 首页 新随笔 联系 订阅 管理

declare @oldname varchar(100),@newname varchar(100)
declare cursor_change cursor for
select name from sysobjects where xtype='u' and substring(name,1,3)='TBL'
open cursor_change
fetch next from cursor_change into @oldname

while @@fetch_status=0

begin

set @newname=replace(@oldname,'TBL','UT')
print @newname
exec sp_rename @oldname,@newname
fetch next from cursor_change into @oldname

end

close cursor_change
deallocate cursor_change

posted on 2009-06-27 21:03  无风kiseki  阅读(242)  评论(0编辑  收藏  举报