Skip to content

Instantly share code, notes, and snippets.

@bifacil
Created August 11, 2019 01:16
Show Gist options
  • Save bifacil/f2d6634d6e8d0d0acc4d13e1573bdbfb to your computer and use it in GitHub Desktop.
Save bifacil/f2d6634d6e8d0d0acc4d13e1573bdbfb to your computer and use it in GitHub Desktop.
-- Elimino la tabla y la vuelvo a cargar (así es más fácil) :-)
DELETE FROM dwh.DimProducts
-- Vaaaaaaamos allá.
INSERT dwh.DimProducts(ProductID,Product,ProductCategory,ProductSubCategory,ProductNumber,ProductModel,Color,StandardCost,ListPrice,Size,SizeUnitMeasureCode,Weight,WeightUnitMeasureCode,ProductLine,DiscontinuedDate,MakeFlag,FinishedGoodsFlag)
SELECT
ProductID,
Product.Name AS Product,
ProductCategory.name AS ProductCategory,
ProductSubCategory.name AS ProductSubCategory,
ProductNumber,
ProductModel.name AS ProductModel,
Color,
StandardCost,
ListPrice,
Size,
SizeUnitMeasureCode,
Weight,
WeightUnitMeasureCode,
ProductLine,
DiscontinuedDate,
MakeFlag,
FinishedGoodsFlag
FROM staging.Product
LEFT JOIN staging.ProductSubCategory ON (Product.ProductSubcategoryID=ProductSubCategory.ProductSubcategoryID)
LEFT JOIN staging.ProductCategory ON (ProductSubCategory.ProductCategoryId=ProductCategory.ProductCategoryId)
LEFT JOIN staging.ProductModel ON (Product.ProductModelID=ProductModel.ProductModelID)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment