본문 바로가기
컴퓨터이야기/MS-SQL

sp저장프로시져만들기(stored procedure)

by 변화지시자 2009. 11. 21.
반응형

create proc addcom
@comname varchar(25),
@commanager smallint,
@keyword varchar(20),
@comintro varchar(1500),
@subpartno smallint

as
set xact_abort on
begin transaction


insert into communite(c_name,c_manager,c_keywd,c_intro,subpart_no)
values(@comname,@commanager,@keyword,@comintro,@subpartno)

declare @no smallint
set @no=@@identity


insert into com_mem(com_no, mem_no, permission)
values (@no,@commanager,0)


commit transaction