That is, create a trigger that prevents me from deleting a record from the 'person' table, but only if the name contains the following characters: 'JUAN' and print the message that can not be deleted
CREATE TRIGGER borrar
ON PERSONA
INSTEAD OF DELETE
AS
SET NOCOUNT ON
DECLARE @NOMBRE VARCHAR(30)
SELECT @NOMBRE = D.NOMBRE
FROM PERSONA P INNER JOIN DELETED D
ON P.ID_PER=D.ID_PER
IF (@NOMBRE LIKE '%JUAN%')
BEGIN
PRINT 'NO ES POSIBLE ELIMINAR'
END
ELSE
DELETE FROM PERSONA WHERE NOMBRE=@NOMBRE
GO