alter TRIGGER AsignacionHorasDocente_TRG
on tbdocentes
after UPDATE
as
BEGIN
DECLARE @nhoraCurso INT = (select sum(hor_curso) from tbcursos where id_categoria=1);
DECLARE @nhoraDocente INT = (select sum(hdi_docente) from tbDocentes where id_categoria=1);
IF @nhoraCurso < @nhoraDocente
BEGIN
PRINT '-------- NO SE PUEDE MODIFICAR PORQUE YA CUMPLIO LA DEMANDA DE HORAS PROGRAMADAS --------';
rollback
END
END
What I need is that the row can not be modified if it complies with the condition @nhoraCurso < @nhoraDocente, the problem is that I get the following message:
-------- CAN NOT BE MODIFIED BECAUSE I ALREADY COMPLY WITH THE DEMAND OF SCHEDULED HOURS --------
Msg 3609, Level 16, State 1, Line 1
The transaction ended in the trigger. The batch has been aborted.
is there any way to hide or delete the 3609 message or another way of doing what I need?