create procedure USP_Carga_Venta as BEGIN insert into FactVentaOrden ( ECliente,EEmpleado,Ubigeo_SKey,EProducto,FechaId,Total ) SELECT distinct ECliente,EEmpleado,Ubigeo_SKey,EProducto,FechaId, (dord.PrecioUnidad*dord.Cantidad) as Total FROM ETL..Orden ord inner join ETL..DetalleOrden dord on ord.IdOrden=dord.IdOrden inner join DimCliente dc on dc.IdCliente=ord.IdCliente inner join DimEmpleado de on de.IdEmpleado=ord.IdEmpleado inner join DimUbigeo du on du.IdDistrito=ord.IdDistrito inner join DimProducto dp on dp.IdProducto=dord.IdProducto inner join DimTiempo dti on dti.Fecha=ord.FechaPedido WHERE (ord.FechaPedido IS NOT NULL) END go
------------------------------LIMPIAR TABLAS ETL-------------------------EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' GO EXEC sp_MSForEachTable 'ALTER TABLE ? DISABLE TRIGGER ALL' GO EXEC sp_MSForEachTable 'BEGIN TRY TRUNCATE TABLE ? END TRY BEGIN CATCH DELETE FROM ? END CATCH;' EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL' GO EXEC sp_MSForEachTable 'ALTER TABLE ? ENABLE TRIGGER ALL' GO DBCC DBCC DBCC DBCC
ALTER ALTER TABLE CLIENTE ADD constraint cliente_pk Primary Key (id_cliente) ALTER TABLE DROP constraint habitaci�n_hotel_FK ALTER TABLE HABITACION ADD constraint habitacion_hotel_fk Foreing Key (id_hotel) References HOTEL (id_hotel); Tarea: Limpiar Tablas 1.- Borrar todos los contrainst de la tabla FacVentaOrden 2.- Delete a las dimensiones Tarea: Cargar tabla de hechos 1.- A�adir los conrtrainst a la tabla FacVentaOrden 2.- Pegar el Script de Insert para FacVenta Orden
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.