读书人

批改数据库用户名为默认

发布时间: 2012-09-14 11:53:44 作者: rapoo

修改数据库用户名为默认

declare tb cursor local forselect 'sp_changeobjectowner''['+replace(user_name(uid),']',']]')+'].['+replace(name,']',']]')+']'',''dbo'''from sysobjectswhere xtype = 'U' and status>=0 and user_name(uid) <> 'dbo'open tbdeclare @s nvarchar(4000)fetch tb into @swhile @@fetch_status=0beginexec(@s)fetch tb into @sendclose tbdeallocate tbgo

读书人网 >其他数据库

热点推荐