Un cordial saludo.
Colegas, es posible crear un trigger en una vista, lo he estado intentando pero me arroja el siguiente error:
este es el trigger
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============
CREATE TRIGGER TR_ENVIA_CORREO_POLIZA
ON VCR_PolizasXSolicitud
FOR UPDATE
as
SET NOCOUNT ON;
--=======================================================
Begin
Declare @Mensaje varchar(200)
Declare @ESTATUS varchar(1)
Declare @TipoVehiculo Varchar(1)
Declare @LS_TEXTO VARCHAR(MAX)
declare @ASUNTO CHAR(200)
Select @ESTATUS = (Select crsol_estado From updated)
Select @TipoVehiculo = (Select crseg_tipo_seguro From updated)
Select @LS_TEXTO = 'Esta es Una Prueba'
SELECT @ASUNTO = 'Generar Poliza '
if @ESTATUS = 'O'
Begin
if @TipoVehiculo < convert(numeric,'3')
Begin
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'jcastro@bangente.com.ve',
@body = @LS_TEXTO,
@subject = @ASUNTO
end
end
--=======================================================
end
GO
Este es el Error:
Msg 8197, Level 16, State 6, Procedure TR_ENVIA_CORREO_POLIZA, Line 6
The object 'VCR_PolizasXSolicitud' does not exist or is invalid for this operation.
Esto indica que la vista no existe, pero si existe...
gracias