상세 컨텐츠

본문 제목

회원과 관련된 내용을 삭제한후 회원삭제 트리거

청강컴정/DataBase

by luckey 2009. 5. 4. 17:27

본문

create trigger TRG_MEMBER_DELETE ON member
instead of delete
as
begin
 declare @sn int
 set @sn = (select sn from deleted)

 delete from member_join where fk_member in @sn
 delete from member_visit where fk_member = @sn
 delete from member where sn = @sn
end

--실행
delete from member where sn = 1

관련글 더보기

댓글 영역