Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/04/2007, 11:57
Draken53
 
Fecha de Ingreso: abril-2007
Mensajes: 1
Antigüedad: 17 años, 10 meses
Puntos: 0
Error en JOB, ayuda urgente

Tengo un job que se ejecuta todos los días antes de la 12 PM, que hace un insert de los registros que cumplan con ciertas características, pero me marca el siguiente error:

Server: Msg 512, Level 16, State 1, Procedure INSERTA_REGISTRO_VOL, Line 6
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

El codigo del JOB es el siguiente

select ID_VOLUNTARIO, NOMBRE,max(fecha) FechaEntrada
into #temporal
from enysa
where month(fecha) = month(getdate())
and year(fecha) = year(getdate())
and day(fecha) = day(getdate())
and enysa = 'ENTRADA'
and TIPO_EMPLEADO = 2
group by ID_VOLUNTARIO,NOMBRE

insert into enysa(id_voluntario, nombre, tipo_empleado, fecha, hora, enysa, tipo_entrada, tipo_chequeo, suma_horas)
select #temporal.ID_VOLUNTARIO, #temporal.NOMBRE, 2, dateadd(hh,1,#temporal.fechaentrada)FechaSalida, '00:00:00', 'SALIDA','SISTEMA','AUTOMATICO',60
from #temporal

Los registros que se insertan pueden variar de 1 o mas, y el error aparece cuando es mas de 1.

Espero su ayuda, gracias.