como colocar varios updates como un solo insert
Publicado por Daniel (5 intervenciones) el 14/04/2011 21:30:48
Bueno, tengo una tabla la cual se actualiza muchas veces por ejemplo
update tbl_Detalle
set valCom = BaseCom * participacion / 100,
comAs = BaseComp * participacion / 100
where idDetPla = @idDetPla
and idDetalleP is not null
update tbl_Detalle
set nuevoValCom = comAs * (100 - porcDeduccion) / 100,
valDed = (comAs * porcDeduccion / 100)
where idDetPla = @idDetPla
and deduc = 1
update tbl_Detalle
set baseSocial = tmp.baseSocial
from (select idDetPla, baseSocial
from tbl_Detalle )
where tbl_Detalle.idDetPla = tmp.idDetPla
como hago para colocar estos tres updates en un solo insert?.
Estoy utilizando sql server 2005
Gracias.
update tbl_Detalle
set valCom = BaseCom * participacion / 100,
comAs = BaseComp * participacion / 100
where idDetPla = @idDetPla
and idDetalleP is not null
update tbl_Detalle
set nuevoValCom = comAs * (100 - porcDeduccion) / 100,
valDed = (comAs * porcDeduccion / 100)
where idDetPla = @idDetPla
and deduc = 1
update tbl_Detalle
set baseSocial = tmp.baseSocial
from (select idDetPla, baseSocial
from tbl_Detalle )
where tbl_Detalle.idDetPla = tmp.idDetPla
como hago para colocar estos tres updates en un solo insert?.
Estoy utilizando sql server 2005
Gracias.
Valora esta pregunta


0