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

    DELETE
      FROM SE_ACCESSDETRIGHTS
     WHERE USERID   = @USERID

    IF (@@error!=0)
    BEGIN
        RAISERROR  20002 'SE_ACCESSDETRIGHTSDelProc: Cannot delete because foreign keys still exist in SE_ACCESSDETRIGHTS '
        ROLLBACK TRAN
        RETURN(1)
    END
    COMMIT TRAN

    RETURN(0)
END