Está en la página 1de 1

de que tabla fisica y servidor se estan construyendo las temporales,

de estas tablas:
adelantos
sco_tc_movimientos (de que servidor y base la saca)
dbo.tmp_sco_tc_ValoresInput (que tabla fisica la construye)
Varaibles:
LANN6
STACUMAS
VT75_2M3_v2
---------
SELECT
cuenta,
1 as vadl_zm3
INTO
dbo.tmp_sco_tc_vadl_zm3
FROM
dbo.tmp_sco_tc_ValoresInput
WHERE
( vAdelantos_4 > 0 OR vAdelantos_5 > 0 OR vAdelantos_6 > 0 )
OR
Cuenta IN (
SELECT id_cuenta_tc
FROM dbo.sco_tc_movimientos
WHERE ID_Periodo=3
AND (
cant_adelantos_efectivo_tc > 0
or monto_adelantos_efectivo_tc > 0
)
)
------------
SELECT cuenta , 1 as IPP6_LM6
FROM
dbo.tmp_sco_tc_ValoresInput
WHERE vPagoshstcierre_1 > 0 and vPagoshstcierre_2 > 0 and vPagoshstcierre_3 > 0
and vPagoshstcierre_4 > 0 and vPagoshstcierre_5 > 0 and vPagoshstcierre_6 > 0
------------
SELECT 1 as B5F_2M3_v2
FROM
dbo.tmp_sco_tc_ValoresInpuWHERE bsf_v2 > 0 AND i IN (5, 4)
------------
SELECT 1 as PEB_B5_v2
FROM
dbo.tmp_sco_tc_ValoresInpu
WHERE vPagoshstcierre_v2_6 >= VSaldoTotal_v2_5 AND vPMin_v2_5 > 0
------------
SELECT
TM.Cuenta ,
CASE WHEN actualPesosSaldoMax6 = 0
THEN 0
ELSE CASE WHEN ( bsfmax6 / actualPesosSaldoMax6 ) < 0 THEN 0
ELSE ( bsfmax6 / actualPesosSaldoMax6 ) END
END AS rbsf_xm6
INTO
dbo.tmp_sco_tc_rbsf_xm6
FROM
dbo.tmp_sco_tc_bsfmax6 TM
LEFT JOIN dbo.tmp_sco_tc_saldomax6 VSC
ON VSC.Cuenta = TM.Cuenta

También podría gustarte