Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/10/2006, 10:12
Avatar de Developer9
Developer9
(Desactivado)
 
Fecha de Ingreso: abril-2005
Ubicación: Mi Ecuador del alma
Mensajes: 4.196
Antigüedad: 19 años, 1 mes
Puntos: 47
Cita:
Iniciado por LUISESPOCH Ver Mensaje
while @x <= @numrows -- Cantidad total de registros para barrerme
Begin
--SELECCIONO LOS RTEGISTROS DE LA FILA ACTUAL PARA UTILIZARLOS LUEGO
select
tmp.IdTransaccion0, tmp.IdTrxOrden, tmp.IdArticulo, tmp.Cantidad, tmp.CantidadFaltante, tmp.Costo, tmp.PVP, tmp.IdBodegaDest

from #Temp_DetalleOrdenes tmp
where tmp.secuencia=@x

--HAGO UNA TRANSACCION DE UPDATE
Update Inv_DetalleOrdenIngresoEgreso
set
Cantidad=tmp.Cantidad, -- De la tabla temporal(*)
CantidadFaltante=tmp.CantidadFaltante -- De la tabla temporal(*)
Where
IdEmpresa = @VL_IdEmpresa
and IdOficina = @VL_IdOficina
and IdBodega = @VL_IdBodega
and IdMotivo = @VL_IdMotivo
and IdTransaccion = @V_IdTransaccion -- De la tabla temporal (*)
and IdArticulo = @V_IdArticulo -- De la tabla temporal (*)


(*): EL ERROR ME SALE EN ESTOS CAMPOS.. Cómo hago?
Gracias por ayudarme...!!!

Eje!!!! los admininstradores del foro darán alguna comisión por traer usuarios nuevos en el foro?

Que tal amigo, tu error está en que tmp.Cantidad (y el resto de variables de la tabla temporal) no está declarada. En el select que haces al inicio del while debes declarar una variable @cantidad y cuando haces el select guardar el valor que te trae el select en dicha variable y luego en el update haces referencia a dicha variable. Igual con el resto de campos de la tabla temporal