Ayuda con trigger

20/07/2007 - 16:44 por Junior | Informe spam
Necesito verificar si el campo SALARIONETO de un registro ha cambiado su
valor para insertar la fecha del sistema en el campo FechaVerAsalFiador, del
mismo registro que estoy modificando, lo que no logro es como identificar si
el valor de campo SALARIONETO cambió o no.

Alguna idea.

CREATE TRIGGER [TR_MAESTRO_FechaVerAsalFiador] ON [dbo].[MAESTRO]
FOR INSERT, UPDATE
AS
BEGIN


update MAESTRO
set FechaVerAsalFiador = getdate()
where NROASOCIA IN (SELECT NROASOCIA FROM inserted) and
SALARIONETO <> (SELECT SALARIONETO FROM DELETED)


END

Preguntas similare

Leer las respuestas

#1 principiante
20/07/2007 - 17:24 | Informe spam
No se si entendi bien.

CREATE TRIGGER [TR_MAESTRO_FechaVerAsalFiador] ON [dbo].[MAESTRO]
FOR INSERT, UPDATE
AS
BEGIN

IF UPDATE(SalarioNeto)
update MAESTRO
set FechaVerAsalFiador = getdate()
from Maestro
Inner Join Inserted I on Maestro.NroAsocia=I.NroAsocia
Left Join Deleted D on Maestro.NroAsocia=D.NroAsocia
where IsNull(D.SalarioNeto, -1) <> I.SalarioNeto

ser cero
D.SalarioNeto<>I.SalarioNeto)


END

Jose TH

"Junior" escribió en el mensaje
news:
Necesito verificar si el campo SALARIONETO de un registro ha cambiado su
valor para insertar la fecha del sistema en el campo FechaVerAsalFiador,
del
mismo registro que estoy modificando, lo que no logro es como identificar
si
el valor de campo SALARIONETO cambió o no.

Alguna idea.

CREATE TRIGGER [TR_MAESTRO_FechaVerAsalFiador] ON [dbo].[MAESTRO]
FOR INSERT, UPDATE
AS
BEGIN


update MAESTRO
set FechaVerAsalFiador = getdate()
where NROASOCIA IN (SELECT NROASOCIA FROM inserted) and
SALARIONETO <> (SELECT SALARIONETO FROM DELETED)


END


Respuesta Responder a este mensaje
#2 Junior
20/07/2007 - 18:52 | Informe spam
Esos es gracias.

"principiante" wrote:


No se si entendi bien.

CREATE TRIGGER [TR_MAESTRO_FechaVerAsalFiador] ON [dbo].[MAESTRO]
FOR INSERT, UPDATE
AS
BEGIN

IF UPDATE(SalarioNeto)
update MAESTRO
set FechaVerAsalFiador = getdate()
from Maestro
Inner Join Inserted I on Maestro.NroAsocia=I.NroAsocia
Left Join Deleted D on Maestro.NroAsocia=D.NroAsocia
where IsNull(D.SalarioNeto, -1) <> I.SalarioNeto

ser cero
D.SalarioNeto<>I.SalarioNeto)


END

Jose TH

"Junior" escribió en el mensaje
news:
> Necesito verificar si el campo SALARIONETO de un registro ha cambiado su
> valor para insertar la fecha del sistema en el campo FechaVerAsalFiador,
> del
> mismo registro que estoy modificando, lo que no logro es como identificar
> si
> el valor de campo SALARIONETO cambió o no.
>
> Alguna idea.
>
> CREATE TRIGGER [TR_MAESTRO_FechaVerAsalFiador] ON [dbo].[MAESTRO]
> FOR INSERT, UPDATE
> AS
> BEGIN
>
>
> update MAESTRO
> set FechaVerAsalFiador = getdate()
> where NROASOCIA IN (SELECT NROASOCIA FROM inserted) and
> SALARIONETO <> (SELECT SALARIONETO FROM DELETED)
>
>
> END
>
>



email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida