Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.37 KB | None | 0 0
  1. --SELECT sc.customerID, pp.FirstName, pp.LastName, pc.Name AS CountryName,
  2. --pc.CountryRegionCode AS CountryCode, ps.StateProvinceCode AS Region
  3.  
  4. --INTO DIMIndividualCustomer
  5. --FROM AdventureWorks2012.Sales.Customer AS sc
  6. --        INNER JOIN AdventureWorks2012.Person.Person AS pp ON sc.PersonID = pp.BusinessEntityID
  7. --        INNER JOIN AdventureWorks2012.Person.BusinessEntityAddress AS pb ON pp.BusinessEntityID = pb.BusinessEntityID
  8. --        INNER JOIN AdventureWorks2012.Person.Address AS pa ON pa.AddressID = pb.AddressID
  9. --        INNER JOIN AdventureWorks2012.Person.StateProvince AS ps ON pa.StateProvinceID = ps.StateProvinceID
  10. --        INNER JOIN AdventureWorks2012.Person.CountryRegion AS pc ON ps.CountryRegionCode = pc.CountryRegionCode;
  11.  
  12. --SELECT sc.customerID, pc.Name AS CountryName,
  13. --pc.CountryRegionCode AS CountryCode, ps.StateProvinceCode AS Region
  14.  
  15. --INTO DIMStoreCustomer
  16. --FROM AdventureWorks2012.Sales.Customer AS sc
  17. --        INNER JOIN AdventureWorks2012.Person.Person AS pp ON sc.PersonID = pp.BusinessEntityID
  18. --        INNER JOIN AdventureWorks2012.Person.BusinessEntityAddress AS pb ON pp.BusinessEntityID = pb.BusinessEntityID
  19. --        INNER JOIN AdventureWorks2012.Person.Address AS pa ON pa.AddressID = pb.AddressID
  20. --        INNER JOIN AdventureWorks2012.Person.StateProvince AS ps ON pa.StateProvinceID = ps.StateProvinceID
  21. --        INNER JOIN AdventureWorks2012.Person.CountryRegion AS pc ON ps.CountryRegionCode = pc.CountryRegionCode;
  22.  
  23. --SELECT pp.Name AS Name, pp.ProductID AS ProductId, pp.ListPrice AS ListPrice, pp.Color AS Color, pp.Size AS Size, pp.Weight AS Weight,
  24. --  pp.MakeFlag AS IsManufactures, pp.FinishedGoodsFlag AS IsSalable, ppc.Name AS Category, pps.Name AS Subcategory
  25. --INTO DIMSProduct
  26. --FROM AdventureWorks2012.Production.Product AS pp
  27. --  INNER JOIN AdventureWorks2012.Production.ProductSubcategory AS pps ON pps.ProductSubcategoryID = pp.ProductSubcategoryID
  28. --  INNER JOIN AdventureWorks2012.Production.ProductCategory As ppc ON pps.ProductCategoryID = pps.ProductCategoryID;
  29.  
  30. SELECT pp.BusinessEntityID AS SalesPersonId, pp.FirstName AS FirstName, pp.LastName AS pp.LastName,
  31.      -- salespersonid, firstname, lastname, title, gender, countrycode, region
  32. INTO DIMSalesPerson
  33. FROM AdventureWorks2012.Sales.SalesPerson AS ssp
  34.     INNER JOIN AdventureWorks2012.Person.Person AS pp ON pp.BusinessEntityID = ssp.BusinessEntityID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement