CREATE PROCEDURE SE_borrargruposdelusuarioProc
(
    @USERID         UD_USERID
  )
AS
BEGIN
    BEGIN TRAN

    DELETE
      FROM SE_USERGROUP
     WHERE USERID  = @USERID
    
    IF (@@error!=0)
    BEGIN
        RAISERROR  20002 'SE_USERGROUPDelProc: Cannot delete because foreign keys still exist in SE_USERGROUP '
        ROLLBACK TRAN
        RETURN(1)
    
    END

    COMMIT TRAN

    RETURN(0)
END


