---------如果人法师>=8,更新所有人法师角色不能上线,如果人法师<8,更新所有人法师角色可以上线
DECLARE @ren int
select @ren =count(*) from knight.dbo.userdata where struserid in (select strcharid from Knight_Account.dbo.CURRENTUSER ) and class=210
if @ren>=8
BEGIN
update knight.dbo.userdata set nServerIndex=2 where class=210 and struserid not in (select strcharid from Knight_Account.dbo.CURRENTUSER )
RETURN
END
select @ren =count(*) from knight.dbo.userdata where struserid in (select strcharid from Knight_Account.dbo.CURRENTUSER ) and class=210
if @ren<8
BEGIN
update knight.dbo.userdata set nServerIndex=1 where class=210 and struserid not in (select strcharid from Knight_Account.dbo.CURRENTUSER )and nServerIndex<>1
RETURN
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
别人发的,你借鉴下。 |