COĞU DBDE EKSİK OLAN ÖNEMLİ BİR PROCEDÜR BUYRUN GÜLE GÜLE KULLANIN
[HIDE-REPLY]USE [kn_online]
GO
/****** Object: StoredProcedure [dbo].[CLAN_NATION_TRANSFER] Script Date: 09/08/2014 01:08:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[CLAN_NATION_TRANSFER]
@ClanName char(21)
AS
/*
Yapan : AKI
16.02.2011
*/
DECLARE @bNation tinyint, @NewNation tinyint,@ClanNation tinyint,@ClanNum smallint
Select @ClanNum=IdNum, @ClanNation=Nation from KNIGHTS where IDName =@ClanName
DECLARE @ClanUser Char(21)
DECLARE @Class tinyint
DECLARE @Race tinyint
DECLARE CLAN CURSOR FOR
SELECT strUserID,Class,Race FROM USERDATA WHERE Knights = @ClanNum
OPEN CLAN
FETCH NEXT FROM CLAN INTO @ClanUser,@Class,@Race
WHILE @@FETCH_STATUS =0
BEGIN
DECLARE @AccountId char(21)
SELECT @AccountId=strAccountID from ACCOUNT_CHAR WHERE strCharID1=@ClanUser or strCharID2=@ClanUser or strCharID3=@ClanUser
SELECT @bNation = bNation FROM ACCOUNT_CHAR WHERE strAccountID = @AccountId
IF @bNation = 1
SET @NewNation = 2
ELSE
SET @NewNation = 1
SET @ClanUser = NULL
SET @Race = 0
SET @Class = 0
SELECT @ClanUser = strCharID1 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID AND strCharID1 IS NOT NULL
IF @ClanUser IS NOT NULL
BEGIN
SELECT @Race = Race,@Class = Class FROM USERDATA WHERE strUserId = @ClanUser
IF @Race = 1
SET @Race = 12
ELSE IF @Race = 2
SET @Race = 12
ELSE IF @Race = 3
SET @Race = 12
ELSE IF @Race = 4
SET @Race = 13
ELSE IF @Race = 11
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 204
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 211
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 212
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 204
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 211
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 212
SET @Race = 4
IF @NewNation = 1
SET @Class = @Class - 100
ELSE
SET @Class = @Class + 100
UPDATE USERDATA SET Nation = @NewNation,Race = @Race,Class = @Class, Rank = 0, Title = 0 FROM USERDATA WHERE strUserId = @ClanUser
END
SET @ClanUser = NULL
SET @Race = 0
SET @Class = 0
SELECT @ClanUser = strCharID2 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID AND strCharID2 IS NOT NULL
IF @ClanUser IS NOT NULL
BEGIN
SELECT @Race = Race,@Class = Class FROM USERDATA WHERE strUserId = @ClanUser
IF @Race = 1
SET @Race = 12
ELSE IF @Race = 2
SET @Race = 12
ELSE IF @Race = 3
SET @Race = 12
ELSE IF @Race = 4
SET @Race = 13
ELSE IF @Race = 11
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 204
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 211
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 212
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 204
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 211
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 212
SET @Race = 4
IF @NewNation = 1
SET @Class = @Class - 100
ELSE
SET @Class = @Class + 100
UPDATE USERDATA SET Nation = @NewNation,Race = @Race,Class = @Class, Rank = 0, Title = 0 FROM USERDATA WHERE strUserId = @ClanUser
END
SET @ClanUser = NULL
SET @Race = 0
SET @Class = 0
SELECT @ClanUser = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID AND strCharID3 IS NOT NULL
IF @ClanUser IS NOT NULL
BEGIN
SELECT @Race = Race,@Class = Class FROM USERDATA WHERE strUserId = @ClanUser
IF @Race = 1
SET @Race = 12
ELSE IF @Race = 2
SET @Race = 12
ELSE IF @Race = 3
SET @Race = 12
ELSE IF @Race = 4
SET @Race = 13
ELSE IF @Race = 11
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 204
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 211
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 212
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 204
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 211
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 212
SET @Race = 4
IF @NewNation = 1
SET @Class = @Class - 100
ELSE
SET @Class = @Class + 100
UPDATE USERDATA SET Nation = @NewNation,Race = @Race,Class = @Class, Rank = 0, Title = 0 FROM USERDATA WHERE strUserId = @ClanUser
END
UPDATE ACCOUNT_CHAR SET bNation = @NewNation WHERE strAccountID = @AccountID
UPDATE KNIGHTS set Nation=@NewNation WHERE IDNum=@ClanNum
DECLARE @OnUser tinyint
SELECT @OnUser = Count(*) FROM CURRENTUSER WHERE strAccountID = @AccountID
IF @OnUser <> 0
BEGIN
INSERT INTO ACCOUNT_NATION_TRANSFERS_QUEUE (AccountID,Process,Description,UpdatedTime) VALUES (@AccountID,0,'Henüz İşlem Yapılmadı.',GETDATE())
END
FETCH NEXT FROM CLAN INTO @ClanUser,@Class,@Race
END
CLOSE CLAN
DEALLOCATE CLAN
IF @NewNation = 1
BEGIN
PRINT '# ' + @ClanName + ' Clani Human IRK''ından Karus IRK''ına Transfer Edildi.'
END
ELSE
BEGIN
PRINT '# ' + @ClanName + ' Clani Karus IRK''ından Human IRK''ına Transfer Edildi.'
END
[/HIDE-REPLY]
[HIDE-REPLY]KULLANIMI= EXEC CLAN_NATION_TRANSFER 'CLAN_İSMİ OZMENKO.COM'[/HIDE-REPLY]
[HIDE-REPLY]USE [kn_online]
GO
/****** Object: StoredProcedure [dbo].[CLAN_NATION_TRANSFER] Script Date: 09/08/2014 01:08:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[CLAN_NATION_TRANSFER]
@ClanName char(21)
AS
/*
Yapan : AKI
16.02.2011
*/
DECLARE @bNation tinyint, @NewNation tinyint,@ClanNation tinyint,@ClanNum smallint
Select @ClanNum=IdNum, @ClanNation=Nation from KNIGHTS where IDName =@ClanName
DECLARE @ClanUser Char(21)
DECLARE @Class tinyint
DECLARE @Race tinyint
DECLARE CLAN CURSOR FOR
SELECT strUserID,Class,Race FROM USERDATA WHERE Knights = @ClanNum
OPEN CLAN
FETCH NEXT FROM CLAN INTO @ClanUser,@Class,@Race
WHILE @@FETCH_STATUS =0
BEGIN
DECLARE @AccountId char(21)
SELECT @AccountId=strAccountID from ACCOUNT_CHAR WHERE strCharID1=@ClanUser or strCharID2=@ClanUser or strCharID3=@ClanUser
SELECT @bNation = bNation FROM ACCOUNT_CHAR WHERE strAccountID = @AccountId
IF @bNation = 1
SET @NewNation = 2
ELSE
SET @NewNation = 1
SET @ClanUser = NULL
SET @Race = 0
SET @Class = 0
SELECT @ClanUser = strCharID1 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID AND strCharID1 IS NOT NULL
IF @ClanUser IS NOT NULL
BEGIN
SELECT @Race = Race,@Class = Class FROM USERDATA WHERE strUserId = @ClanUser
IF @Race = 1
SET @Race = 12
ELSE IF @Race = 2
SET @Race = 12
ELSE IF @Race = 3
SET @Race = 12
ELSE IF @Race = 4
SET @Race = 13
ELSE IF @Race = 11
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 204
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 211
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 212
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 204
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 211
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 212
SET @Race = 4
IF @NewNation = 1
SET @Class = @Class - 100
ELSE
SET @Class = @Class + 100
UPDATE USERDATA SET Nation = @NewNation,Race = @Race,Class = @Class, Rank = 0, Title = 0 FROM USERDATA WHERE strUserId = @ClanUser
END
SET @ClanUser = NULL
SET @Race = 0
SET @Class = 0
SELECT @ClanUser = strCharID2 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID AND strCharID2 IS NOT NULL
IF @ClanUser IS NOT NULL
BEGIN
SELECT @Race = Race,@Class = Class FROM USERDATA WHERE strUserId = @ClanUser
IF @Race = 1
SET @Race = 12
ELSE IF @Race = 2
SET @Race = 12
ELSE IF @Race = 3
SET @Race = 12
ELSE IF @Race = 4
SET @Race = 13
ELSE IF @Race = 11
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 204
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 211
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 212
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 204
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 211
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 212
SET @Race = 4
IF @NewNation = 1
SET @Class = @Class - 100
ELSE
SET @Class = @Class + 100
UPDATE USERDATA SET Nation = @NewNation,Race = @Race,Class = @Class, Rank = 0, Title = 0 FROM USERDATA WHERE strUserId = @ClanUser
END
SET @ClanUser = NULL
SET @Race = 0
SET @Class = 0
SELECT @ClanUser = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID AND strCharID3 IS NOT NULL
IF @ClanUser IS NOT NULL
BEGIN
SELECT @Race = Race,@Class = Class FROM USERDATA WHERE strUserId = @ClanUser
IF @Race = 1
SET @Race = 12
ELSE IF @Race = 2
SET @Race = 12
ELSE IF @Race = 3
SET @Race = 12
ELSE IF @Race = 4
SET @Race = 13
ELSE IF @Race = 11
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 201
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 205
SET @Race = 1
ELSE IF @Race = 13 AND @Class = 206
SET @Race = 1
ELSE IF @Race = 12 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 202
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 207
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 208
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 203
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 209
SET @Race = 3
ELSE IF @Race = 13 AND @Class = 210
SET @Race = 3
ELSE IF @Race = 12 AND @Class = 204
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 211
SET @Race = 2
ELSE IF @Race = 12 AND @Class = 212
SET @Race = 2
ELSE IF @Race = 13 AND @Class = 204
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 211
SET @Race = 4
ELSE IF @Race = 13 AND @Class = 212
SET @Race = 4
IF @NewNation = 1
SET @Class = @Class - 100
ELSE
SET @Class = @Class + 100
UPDATE USERDATA SET Nation = @NewNation,Race = @Race,Class = @Class, Rank = 0, Title = 0 FROM USERDATA WHERE strUserId = @ClanUser
END
UPDATE ACCOUNT_CHAR SET bNation = @NewNation WHERE strAccountID = @AccountID
UPDATE KNIGHTS set Nation=@NewNation WHERE IDNum=@ClanNum
DECLARE @OnUser tinyint
SELECT @OnUser = Count(*) FROM CURRENTUSER WHERE strAccountID = @AccountID
IF @OnUser <> 0
BEGIN
INSERT INTO ACCOUNT_NATION_TRANSFERS_QUEUE (AccountID,Process,Description,UpdatedTime) VALUES (@AccountID,0,'Henüz İşlem Yapılmadı.',GETDATE())
END
FETCH NEXT FROM CLAN INTO @ClanUser,@Class,@Race
END
CLOSE CLAN
DEALLOCATE CLAN
IF @NewNation = 1
BEGIN
PRINT '# ' + @ClanName + ' Clani Human IRK''ından Karus IRK''ına Transfer Edildi.'
END
ELSE
BEGIN
PRINT '# ' + @ClanName + ' Clani Karus IRK''ından Human IRK''ına Transfer Edildi.'
END
[/HIDE-REPLY]
[HIDE-REPLY]KULLANIMI= EXEC CLAN_NATION_TRANSFER 'CLAN_İSMİ OZMENKO.COM'[/HIDE-REPLY]