묻고답하기

CREATE TRIGGER trg_mug_new2
ON char_data
For update
AS
update char_data
   set char_name = replace(i.char_name, '$C', '$B'), char_level=11, char_str=45, char_con=0, char_w1=0, char_w2=0, char_w3=0, char_w4=0, char_str_exp=0, char_con_exp=0, char_dex_exp=0, char_w1_exp=0, char_w2_exp=0, char_w3_exp=0, char_w4_exp=0, char_max_hit=(i.char_max_hit*0.6), char_hit=(i.char_hit*0.6), char_exp=0 , char_chk=2
   from char_data c inner join inserted i on i.char_serial = c.char_serial  
   where i.char_level>=1500 and (i.char_str+
             case when i.char_class=0 then i.char_w1
                  when i.char_class=1 then i.char_w2
                  when i.char_class=2 then i.char_w3
                  when i.char_class=3 then i.char_w4
                end
)>=5000 and i.char_chk = 1
--------------------------------------------------------
사용된 트리거는 이것이구요.. 이트리거를 실행시키기위해
업데이트를 해보면 아래그림처럼 오류가뜨네용..
--------------------------------------------------------


--------------------------------------------------------
그리구 char_data 테이블의 속성은 이렇습니다..
--------------------------------------------------------
CREATE TABLE [dbo].[Char_Data] (
        [Char_Serial] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
        [Char_Account_Num] [int] NULL ,
        [Char_Name] [nvarchar] (12) COLLATE Korean_Wansung_CI_AS NULL ,
        [Char_Title] [varchar] (12) COLLATE Korean_Wansung_CI_AS NULL ,
        [Char_Level] [smallint] NULL ,
        [Char_Str] [smallint] NULL ,
        [Char_Dex] [smallint] NULL ,
        [Char_Con] [smallint] NULL ,
        [Char_W1] [smallint] NULL ,
        [Char_W2] [smallint] NULL ,
        [Char_W3] [smallint] NULL ,
        [Char_W4] [smallint] NULL ,
        [Char_Str_Exp] [int] NULL ,
        [Char_Dex_Exp] [int] NULL ,
        [Char_Con_Exp] [int] NULL ,
        [Char_W1_Exp] [int] NULL ,
        [Char_W2_Exp] [int] NULL ,
        [Char_W3_Exp] [int] NULL ,
        [Char_W4_Exp] [int] NULL ,
        [Char_Hit] [int] NULL ,
        [Char_Max_Hit] [int] NULL ,
        [Char_Mana] [int] NULL ,
        [Char_Max_Mana] [int] NULL ,
        [Char_Exp] [int] NULL ,
        [Char_Class] [tinyint] NULL ,
        [Char_Sex] [tinyint] NULL ,
        [Char_Agi] [tinyint] NULL ,
        [Char_Gold] [bigint] NULL ,
        [Char_Age] [int] NULL ,
        [Char_Last_Logon] [datetime] NULL ,
        [Char_X] [smallint] NULL ,
        [Char_Y] [smallint] NULL ,
        [Char_Zone] [tinyint] NULL ,
        [Char_Dir] [tinyint] NULL ,
        [Char_Admin_Level] [tinyint] NULL ,
        [Char_Flags] [int] NULL ,
        [Char_Grade] [smallint] NULL ,
        [Char_Ext] [int] NULL ,
        [Char_CHK] [int] NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Char_Data] ADD
        CONSTRAINT [DF_Char_Data_Char_Grade] DEFAULT (0) FOR [Char_Grade],
        CONSTRAINT [DF_Char_Data_Char_Ext] DEFAULT (0) FOR [Char_Ext],
        CONSTRAINT [DF_Char_Data_Char_CHK] DEFAULT (0) FOR [Char_CHK]
GO
------------------------------------------------------
결론을 말씀드리자면..트리거문에 for update 가아닌 instead of update 를 사용하면 잘작동하더라구요. 하지만 instead of update
를 사용하니 데이터값들이 증가하질않고 계속 원상복귀에요.
char_level을 예로들자면 트리거가작동해서 char_level = 11
이되고 또 업데이트이벤트가일어나면 char_level의 값이 증가하질않
는다는거죠. for update를 사용하면 저런오류가 뜨궁..휴.;;
혹시 replace 함수 때문인건가요.?
초보라 설명이 이상하네요..ㅠㅠ 해결책좀..부탁합니다.ㅠ
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
최상현 회원가입양식의 정보등록 페이지를 만들려고 하는데요..도와주세요 [1] 2007.08.10
전욱진 이 메뉴는 어떡게 만들어야 하죠? [2] 2007.08.10
버찌 포토샵...설치후 왜 이런문제가..  
슈디 스타일시트 만드는 방법 좀 알려주세요~ [1] 2007.08.10
김민규 ntsysv에 대한 질문이요....  
이성진 암호받아서 창띠우는거... [1] 2007.08.10
김진섭 cgi에서는 프레임을 어떻게 나누나요.. [3] 2007.08.10
최고 나모fx에서 초보적인 버튼만들기 질문 -_- [2] 2007.08.10
jeni 웹빌더 어떤게 좋나요..... [1] 2007.08.10
beMax [보안]이런수작을 못하게 하고싶습니다. [5] 2007.08.10
AiKa 플레쉬안파일 [1] 2007.08.10
토토짱 간단한 메일보내기 마드는방법 [1] 2007.08.10
Eniun 오라클을 mysql로 전환하는방법  
슈바 제로보드 기본 스킨 nzeo_ver3 사용하는데요. 카테고리가 전혀 안떠요. [1] 2007.08.10
함태준 B4 크기를 A4 용지로 나누어서 뽑으려면? [1] 2007.08.10
無題 답변좀 부탁드립니다. [2] 2007.08.10
이성복 아파치 서버 와 IIS [2] 2007.08.10
단비아빠 리눅스 MySQL의 값을 MS서버의 MS-SQL로 넘겨주는 방법좀 알려주세요. [1] 2007.08.10
이규재 포토샵 그라디언트를 적용하면 흑백으로 나옵니다...?? [2] 2007.08.10
이성복 아파치 서버 와 IIS [2] 2007.08.10
단비아빠 리눅스 MySQL의 값을 MS서버의 MS-SQL로 넘겨주는 방법좀 알려주세요. [1] 2007.08.10
이규재 포토샵 그라디언트를 적용하면 흑백으로 나옵니다...?? [2] 2007.08.10
안대민 스타일 시트 관련 질문 드립니다. [2] 2007.08.10
Aniori 버튼 하나누르면 프레임 두곳 바뀌게 하는법 질문 [1] 2007.08.10
김명규 글쓰기 대이터값을 db에 입력할때 변수를 알고싶어요 [1] 2007.08.10
박무환 로그인 페이지에서 쿠키 사용시 에러  
샬랄라 실명인증 서비스 사용하려고 하는데요, [3] 2007.08.10
김현정 플래쉬 관련 질문인데요~ (사운드) [1] 2007.08.10
김찬우 이미지에 특정한 부분을 클릭하면 다음 페이지로 넘어가게... [1] 2007.08.10
이준한 mssql관련질문입니다. 도와주셔요 ㅠ