27 de abril de 2014

Where en Load manteniendo QVD Optimized

Diferentes técnicas para filtrar un qvd manteniendo carga QVD Optimized


1. Carga la tabla Ventas.qvd únicamente con registros del 1/Ene/2014, manteniendo QVD Optimized

Temporal:
LOAD MakeDate(2014,01,01)  AS Fecha AutoGenerate 1;

Ventas:
LOAD VentasSucursal,Fecha 
From Ventas.qvd (qvdWhere Exists(Fecha);
DROP Table Temporal; 





2. Carga la tabla Ventas.qvd unicamente con registros de los días 1, 8 y 24 de Enero del 2014, manteniendo carga QVD Optimized

Temporal:
LOAD MakeDate(2014,01,01)  AS Fecha AutoGenerate 1;
LOAD MakeDate(2014,01,08)  AS Fecha AutoGenerate 1;
LOAD MakeDate(2014,01,24)  AS Fecha AutoGenerate 1;

Ventas:
LOAD VentasSucursal,Fecha
From Ventas.qvd (qvd)Where Exists(Fecha);
DROP Table Temporal; 



3. Carga la tabla Ventas.qvd unicamente con registros desde el día 1/Ene/2014 hasta el 15/Ene/2014, manteniendo QVD Optimized

Temporal: 
LOAD MakeDate(2014,01,01)+RowNo()-1 AS Fecha AutoGenerate 15;

Ventas:
LOAD VentasSucursal,Fecha
From Ventas.qvd (qvd)Where Exists(Fecha);

DROP Table Temporal; 




4. Carga la tabla Ventas.qvd únicamente con registros del dia 1/Ene/2014 y de Sucursal Norte

Temporal_1: 

LOAD MakeDate(2014,01,01)  AS Fecha AutoGenerate 1;

Ventas_tmp: 
LOAD Ventas,Sucursal,Fecha
From Ventas.qvd (qvdWhere Exists(Fecha);
Store Ventas_tmp into Ventas_tmp.qvd;
DROP Table Ventas_tmp, Temporal_1;

Temporal_2: 

LOAD 'Norte' as Sucursal AutoGenerate 1;

Ventas: 

LOAD * From Ventas_tmp.qvd (qvd)Where Exists(Sucursal);
DROP Table Temporal_2;


5. Carga de la tabla Ventas.qvd únicamente los registros con venta diferente a cero


Temporal: LOAD 0 as Venta AutoGenerate 1;
Ventas:LOAD Venta, Sucursal, Fecha
FROM Ventas.qvd (qvdWhere not Exists(Ventas);






No hay comentarios: