sp_helptext proc_SetJurisdiction go CREATE proc proc_SetJurisdiction ( @p_id varchar(40), @staffs varchar(300), @groups varchar(300) ) as begin begin tran begin try if exists(select * from Project_Jurisdiction where p_id = @p_id) begin delete from Project_Jurisdiction where p_id =@p_id end if(@staffs<>'') begin insert into Project_Jurisdiction(p_id,j_id,j_type) select @p_id p_id,id j_id,0 j_type from F_Char_s(@staffs) end if(@groups<>'') begin insert into Project_Jurisdiction(p_id,j_id,j_type) select @p_id p_id,id j_id,1 j_type from F_Char_s(@groups) end commit tran select '1' end try begin catch rollback tran select '0' end catch end