 - /****** Object: Stored Procedure dbo.ACCOUNT_NATION_CHECK2 Script Date: 6/6/2006 6:03:33 PM ******/
- -- 팀장님 중국 재미있어요? --;
- -- 팀장님 땜에 전 이 고달픈 프로시져 짜야 되요 ㅠ.ㅠ
- CREATE PROCEDURE ACCOUNT_NATION_CHECK2 AS
- ------------------------------------------------------------------------------------------------
- -- 변수들을 선언하는 부분
- DECLARE @strAccountID char(31), @strCharID1 char(31), @strCharID2 char(31), @strCharID3 char(31)
- DECLARE @bNation tinyint, @bCharNum tinyint, @row tinyint
- DECLARE @bNation1 tinyint, @bNation2 tinyint, @bNation3 tinyint -- 이건 국가 차이 ^^;
- SET @strAccountID = null
- SET @strCharID1 = null
- SET @strCharID2 = null
- SET @strCharID3 = null
- SET @bNation = 0
- SET @bCharNum = 0
- SET @bNation1 = 0
- SET @bNation2 = 0
- SET @bNation3 = 0
- SET @row = 0
- --------------------------------------------------------------------------------------------------
- -- 이 부분은 계정과 캐릭의 국가가 틀린 유저들을 임시 테이블에 넣는다.
- DECLARE Backup_Cursor CURSOR FOR
- SELECT strAccountID, bNation, bCharNum, strCharID1, strCharID2, strCharID3
- FROM ACCOUNT_CHAR WHERE bCharNum > 0
- OPEN Backup_Cursor
- FETCH NEXT FROM Backup_Cursor INTO @strAccountID, @bNation, @bCharNum,
- @strCharID1, @strCharID2, @strCharID3
-
- WHILE @@FETCH_STATUS = 0
- BEGIN
- SET @bNation1 = 0
- SET @bNation2 = 0
- SET @bNation3 = 0
- /*
- SELECT @row = count(*)
- FROM ACCOUNT_NATION_CHECK -- 이 테이블에다가 명단을 넣을 계획임
- WHERE strAccountID = @strAccountID
- */
- -----------------------------------------------------------
- -- 비교될 캐릭들의 국가 정보 얻어온다 :)
- SELECT @bNation1 = Nation -- 첫번째 비교 캐릭
- FROM USERDATA WHERE strUserID = @strCharID1
-
- SELECT @bNation2 = Nation -- 두번째 비교 캐릭
- FROM USERDATA WHERE strUserID = @strCharID2
-
- SELECT @bNation3 = Nation -- 세번째 비교 캐릭
- FROM USERDATA WHERE strUserID = @strCharID3
- ------------------------------------------------------------
- IF (((@bNation <> @bNation1) AND @bNation1 > 0) OR ((@bNation <> @bNation2) AND @bNation2 > 0 )
- OR ((@bNation <> @bNation3) AND @bNation3 > 0))
- BEGIN
- INSERT INTO ACCOUNT_NATION_CHECK(strAccountID, byAC_Nation, byChar_N1, byChar_N2, byChar_N3, strChar_ID1, strChar_ID2, strChar_ID3)
- VALUES (@strAccountID, @bNation, @bNation1, @bNation2, @bNation3, @strCharID1, @strCharID2, @strCharID3 )
- END
-
- FETCH NEXT FROM Backup_Cursor INTO @strAccountID, @bNation, @bCharNum,
- @strCharID1, @strCharID2, @strCharID3
- END
- CLOSE Backup_Cursor
- DEALLOCATE Backup_Cursor
- GO
复制代码 |