Tema: For update
Ver Mensaje Individual
  #6 (permalink)  
Antiguo 18/08/2010, 12:27
Avatar de iislas
iislas
Colaborador
 
Fecha de Ingreso: julio-2007
Ubicación: Mexico, D.F.
Mensajes: 6.482
Antigüedad: 16 años, 10 meses
Puntos: 180
Respuesta: For update

Código SQL:
Ver original
  1. IF (UPDATE (a) OR UPDATE(b))
  2. BEGIN
  3.     INSERT INTO tabla(fecha, a, b)
  4.     SELECT getdate(), a, b
  5.     FROM tablaActualizada ta
  6.     WHERE a EXISTS(SELECT a FROM inserted i WHERE i.a = ta.a ) OR
  7.     b EXISTS(SELECT b FROM inserted x WHERE x.b = ta.b)
  8. END