@BeginTime INT
@EndTime INT
set @BeginTime= 1
set @EndTime= 180000   --打乱多少次,比GameIdentifier表最大的 UserID 小一些

@FirstID INT
@SecondID INT
@FirstTempID INT
@SecondTempID INT

网狐棋牌平台的打乱注册ID混乱数据脚本 网狐 网狐棋牌 棋牌 棋牌技术  第1张

@MaxD INT
@INT

select  @MaxD=count()   from [QPGameUserDB].[dbo].[GameIdentifier]
set  @= len(CONVERT(10), @MaxD))


while (@BeginTime<@EndTime)
BEGIN

网狐棋牌平台的打乱注册ID混乱数据脚本 网狐 网狐棋牌 棋牌 棋牌技术  第2张

set @FirstID= @BeginTime+(cast((cast(power(10,(cast((@Count-1)rand(checksum(newid())) as int)+1)) as int))rand(checksum(newid())) as int))+1
set @SecondID= @MaxD-(cast((cast(power(10,(cast((@Count-1)rand(checksum(newid())) as int)+1)) as int))rand(checksum(newid())) as int))+1
select   @FirstID, @SecondID ,@MaxD
if @FirstID > @MaxD
begin
  set @FirstID=@MaxD-(cast((cast(power(10,(cast((@Count-2)rand(checksum(newid())) as int)+1)) as int))rand(checksum(newid())) as int))
end
if @SecondID > @MaxD
begin
  set @SecondID=@MaxD-(cast((cast(power(10,(cast((@Count-1)rand(checksum(newid())) as int)+1)) as int))rand(checksum(newid())) as int))
end
select   @FirstID, @SecondID, @MaxD
@FirstTempID = GameID from GameIdentifier where UserID 
@SecondTempID = GameID from GameIdentifier where UserID 

-- @FirstTempID , @SecondTempID

GameIdentifier set GameID = GameID10 where UserID 
GameIdentifier set GameID = @FirstTempID where UserID 
GameIdentifier set GameID = @SecondTempID where UserID 

@FirstTempID = GameID from GameIdentifier where UserID 
@SecondTempID = GameID from GameIdentifier where UserID 
-- @FirstTempID , @SecondTempID

SET @BeginTime=@BeginTime+1
END

未经允许不得转载! 作者:棋牌源码网,转载或复制请以超链接形式并注明出处棋牌源码网

原文地址:《网狐棋牌平台的打乱注册ID混乱数据脚本》发布于:2021-08-06