Update Temporal

24/11/2005 - 17:23 por Aventurero | Informe spam
Buenos días amigos del Foro.
Tengo un inconveniente que no lo he podido resolver.

create table #Tempo (formato bigint, ImgEstado varchar(50))

insert into #TempoSoat
select formato, '..\imagenes\PuntoOut.gif' as ImgEstado from
TablaMediodePunto
where punto = '181'

UPDATE #TempoSoat SET ImgEstado case TablaSerie.estado
when 'E' then '..\imagenes\PuntoUp.gif'
else '..\imagenes\PuntoIn.gif'
end
from TablaMediodePunto inner join TablaSerie on
TablaMediodePunto.formato = TablaSerie.formato and
TablaMediodePunto.punto_venta = TablaSerie.punto_venta and
TablaMediodePunto.codigo_compania = TablaSerie.codigo_compania

Siempre me deja en '..\imagenes\PuntoUp.gif' la columna ImgEstado.
y TablaSerie.estado tiene 'E' o 'A' o 'V' o 'X'

Tengo algo mal en el UPDATE?

Gracias,


Aventurero
 

Leer las respuestas

#1 Ele
24/11/2005 - 17:37 | Informe spam
hola en lo personal yo haria el update asi

UPDATE A
SET A.ImgEstado =case C.estado when 'E' then '..\imagenes\PuntoUp.gif'
else '..\imagenes\PuntoIn.gif' end
from #TempoSoat A
inner join TablaMediodePunto B on B.formato = A.formato
inner join TablaSerie C on C.formato = B.formato and C.punto_venta B.punto_venta and C.codigo_compania = B.codigo_compania
suerte

"Aventurero" escribió en el mensaje
news:%
Buenos días amigos del Foro.
Tengo un inconveniente que no lo he podido resolver.

create table #Tempo (formato bigint, ImgEstado varchar(50))

insert into #TempoSoat
select formato, '..\imagenes\PuntoOut.gif' as ImgEstado from
TablaMediodePunto
where punto = '181'

UPDATE #TempoSoat SET ImgEstado > case TablaSerie.estado
when 'E' then '..\imagenes\PuntoUp.gif'
else '..\imagenes\PuntoIn.gif'
end
from TablaMediodePunto inner join TablaSerie on
TablaMediodePunto.formato = TablaSerie.formato and
TablaMediodePunto.punto_venta = TablaSerie.punto_venta and
TablaMediodePunto.codigo_compania = TablaSerie.codigo_compania

Siempre me deja en '..\imagenes\PuntoUp.gif' la columna ImgEstado.
y TablaSerie.estado tiene 'E' o 'A' o 'V' o 'X'

Tengo algo mal en el UPDATE?

Gracias,


Aventurero


Preguntas similares