sql 删除狐立帐户

declare @username nvarchar(50)

create table #temp_user(
username nvarchar(50),
UserSID int
)

insert into #temp_user exec sp_change_users_login @Action='Report'

declare temp_cursor cursor for
select username from #temp_user

open temp_cursor
fetch next from temp_cursor into @username
WHILE (@@FETCH_STATUS=0)
begin
exec sp_change_users_login 'Auto_Fix', @username, NULL, @username;
exec sp_change_users_login @Action='update_one',@UserNamePattern=@username,@LoginName=@username;
fetch next from temp_cursor into @username
end
close temp_cursor
deallocate temp_cursor
drop table #temp_user

posted on 2020-10-25 20:04  木龙哥  阅读(161)  评论(0编辑  收藏  举报

导航