_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 覲旧SID蠍壱
declare @LOGINNAME varchar(100)

declare @CHANGECOMMAND varchar(100)

declare USERCURSOR cursor for 
  select name from sysusers 
  where name not in (
' public'
, 'dbo'
, 'guest'
, 'sys'
, 'Information_schema'
, 'db_owner'
, 'db_accessadmin'
, 'db_securityadmin'
, 'db_ddladmin'
, 'db_backupoperator'
, 'db_datareader'
, 'db_datawriter'
, 'db_denydatareader'
, 'db_denydatawriter')

open USERCURSOR

fetch next from USERCURSOR into @LOGINNAME
while @@fetch_status=0
begin

  select @CHANGECOMMAND = 'exec sp_change_users_login ''Auto_Fix'', ''' +@LOGINNAME + ''''
  PRINT 'Executing the command '+@CHANGECOMMAND
  exec (@CHANGECOMMAND )

  fetch next from USERCURSOR into @LOGINNAME
end

close USERCURSOR
deallocate USERCURSOR
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

螻 覓願 蟆 譴 襯 朱 蟆企. (W.)