Trigger para una Vista
Publicado por jcastro (3 intervenciones) el 19/09/2007 16:12:26
Un gran saludo colegas.
Estoy intentando crear un trigger para una vista, el tema es que no estoy seguro si esto es posible. El codigo que estoy usando es el siguiente:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ======================================================
CREATE TRIGGER TR_ENVIA_CORREO_POLIZA
ON dbo.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 = '[email protected]',
@body = @LS_TEXTO,
@subject = @ASUNTO
end
end
--=======================================================
end
GO
Esto lo estoy intentndo guardar en una vista, el error es el siguiente:
Msg 8197, Level 16, State 6, Procedure TR_ENVIA_CORREO_POLIZA, Line 6
The object 'dbo.VCR_PolizasXSolicitud' does not exist or is invalid for this operation.
Gracias de antemano.
Estoy intentando crear un trigger para una vista, el tema es que no estoy seguro si esto es posible. El codigo que estoy usando es el siguiente:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ======================================================
CREATE TRIGGER TR_ENVIA_CORREO_POLIZA
ON dbo.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 = '[email protected]',
@body = @LS_TEXTO,
@subject = @ASUNTO
end
end
--=======================================================
end
GO
Esto lo estoy intentndo guardar en una vista, el error es el siguiente:
Msg 8197, Level 16, State 6, Procedure TR_ENVIA_CORREO_POLIZA, Line 6
The object 'dbo.VCR_PolizasXSolicitud' does not exist or is invalid for this operation.
Gracias de antemano.
Valora esta pregunta


0