En un trigger envío un mensaje de error con raiserror creado anteriormente
con sp_addmessage. El mensaje fue añadido del siguiente modo:
sp_addmessage 60000, 16, 'El cliente %s debe existir'
En el trigger lanzo el mensaje del siguiente modo:
if exists
(
select 'true'
from inserted i
left join customers c
on i.customerid = c.customerid
where c.customerid is null
)
begin
raiserror (60000, 16, 1, 'CustomerID')
rollback tran
end
Al probarlo veo lo siguiente:
Servidor: mensaje 60000, nivel 16, estado 1, procedimiento
PedidoTieneCliente, línea 14
pero no aparece el mensaje "el cliente ... debe existir'.
¿Por qué?
Gracias por la ayuda.
Leer las respuestas