BDG Scenario 3

lw_deletePersonGroup.sql

If Exists (Select * From sysobjects Where name = N'lw_deletePersonGroup' And user_name(uid) = N'dbo')
    Drop Procedure dbo.lw_deletePersonGroup
Go

Create Procedure lw_deletePersonGroup  
(
        @personGroupId int
)
As
 set nocount on
 
 if exists(select * from personGroup where personGroupId=@personGroupId)
    begin  
       delete from personGroup where personGroupId = @personGroupId
       return 0
    end
 else
    begin
       raiserror('personGroupId %ld does not exist.',-1,-1,@personGroupId) with nowait
       return 1
    end
Go