ssis guia basica

Post on 12-Aug-2015

55 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Tabla de contenido

1 SQL SERVER INTEGRATION SERVICES (SSIS)........................................................................................................................ 2

1.1 OBJETIVO GENERAL..................................................................................................................................................................21.2 CREANDO EL PROYECTO DE SSIS.................................................................................................................................................31.3 DIMENSIONES..........................................................................................................................................................................4

1.3.1 Dim Categorias............................................................................................................................................................41.3.2 Dim Productos.............................................................................................................................................................81.3.3 Dim Clientes...............................................................................................................................................................111.3.4 Dim Empleados..........................................................................................................................................................131.3.5 Dim Tiempo...............................................................................................................................................................15

1.4 FACT TABLES.........................................................................................................................................................................181.4.1 FT_Order_Details.......................................................................................................................................................18

2 SQL SERVER ANALYSIS SERVICES (SSAS)........................................................................................................................... 23

2.1 OBJETIVO GENERAL................................................................................................................................................................232.2 CREANDO EL PROYECTO DE SSAS..............................................................................................................................................232.3 CREANDO EL CUBO.................................................................................................................................................................24

2.3.1 New data source........................................................................................................................................................242.3.2 New Data Source View..............................................................................................................................................252.3.3 New Cube..................................................................................................................................................................272.3.4 Procesando el cubo....................................................................................................................................................29

2.4 NAVEGANDO SOBRE LAS TABLAS...............................................................................................................................................302.4.1 Explorando el contenido de una tabla.......................................................................................................................30

2.4.1.1 Distintas opciones al navegar en el contenido de una tabla......................................................................................................302.5 EDITANDO UNA DIMENSIÓN.....................................................................................................................................................322.6 EDITANDO UN CUBO...............................................................................................................................................................32

2.6.1 Cube Structure...........................................................................................................................................................332.6.2 Dimension Usage.......................................................................................................................................................332.6.3 Calculations...............................................................................................................................................................332.6.4 KPIs............................................................................................................................................................................332.6.5 Actions.......................................................................................................................................................................342.6.6 Partitions...................................................................................................................................................................342.6.7 Aggregations.............................................................................................................................................................342.6.8 Perspectives...............................................................................................................................................................342.6.9 Translations...............................................................................................................................................................342.6.10 Browser.....................................................................................................................................................................34

3 PIVOTEANDO UN CUBO DESDE EXCEL.............................................................................................................................. 36

3.1 CREANDO LA CONEXIÓN..........................................................................................................................................................363.2 ACEZANDO AL CUBO...............................................................................................................................................................363.3 PIVOTEANDO.........................................................................................................................................................................36

4 SQL SERVER REPORTING SERVICES (SSRS)........................................................................................................................ 36

4.1 CREANDO EL PROYECTO DE SSRS..............................................................................................................................................364.2 CREANDO UN REPORTE CUYA FUENTE DE DATOS SEA UN CUBO........................................................................................................36

5 REPORT MODEL PROJECT................................................................................................................................................. 36

1

1 SQL Server Integration Services (SSIS)

1.1 Objetivo general

Crear un paquete ETL (Extract, transform and load (extracción, transformación y carga)) con la herramienta de MS SSIS.

2

1.2 Creando el proyecto de SSIS

3

1.3 Dimensiones

1.3.1 Dim Categorias

4

5

6

7

1.3.2 Dim Productos

SELECTP.ProductID, P.ProductName, P.CategoryID, S.SupplierID, S.CompanyName AS SupplierCompanyName, S.City AS SupplierCity, S.Region AS SupplierRegion, S.Country AS SupplierCountry

FROM dbo.Products AS P INNER JOINdbo.Suppliers AS S ON P.SupplierID = S.SupplierID

8

9

10

1.3.3 Dim Clientes

11

12

1.3.4 Dim Empleados

SELECTEmployeeID, LastName, FirstName, City, Region, Country, ReportsTo, LastName + ', ' + FirstName AS FullName

FROM Northwind.dbo.Employees

13

14

1.3.5 Dim Tiempo

SELECT DISTINCT OrderDate AS Date, DATEPART( yyyy, OrderDate ) AS [Year], DATEPART( qq, OrderDate ) AS [Quarter], DATEPART( mm, OrderDate ) AS [Month], LEFT( CONVERT(varchar, OrderDate, 100), 3) AS

[Month_name]

15

FROM Northwind.dbo.Orders

UNION

SELECT DISTINCT ShippedDate, DATEPART( yyyy, ShippedDate ) AS [Year], DATEPART( qq, ShippedDate ) AS [Quarter], DATEPART( mm, ShippedDate ) AS [Month], LEFT( CONVERT(varchar, ShippedDate, 100), 3) AS

[Month_name]FROM Northwind.dbo.Orders

UNION

SELECT DISTINCT RequiredDate, DATEPART( yyyy, RequiredDate ) AS [Year], DATEPART( qq, RequiredDate ) AS [Quarter], DATEPART( mm, RequiredDate ) AS [Month], LEFT( CONVERT(varchar, RequiredDate, 100), 3) AS

[Month_name]FROM Northwind.dbo.Orders

ORDER BY 1

16

17

1.4 Fact tables

1.4.1 FT_Order_Details

SELECTOD.ProductID, O.CustomerID, O.EmployeeID, O.OrderDate, O.ShippedDate, O.RequiredDate, OD.UnitPrice, OD.Quantity, OD.Discount

FROM Northwind.dbo.Orders AS O INNER JOINNorthwind.dbo.[Order Details] AS OD ON O.OrderID =

OD.OrderID

18

19

20

21

1. Verificando1.1. Para verificar si los registros son cargados correctamente podrías utilizar la siguiente consulta

SELECT *FROM INFORMATION_SCHEMA.TABLES;

SELECT 'SELECT ''' + TABLE_NAME + ''' AS TABLE_NAME, COUNT(1) AS TOTAL FROM ' + TABLE_SCHEMA + '.' + TABLE_NAME + ' UNION ' AS SQL_StmtFROM INFORMATION_SCHEMA.TABLESWHERE TABLE_TYPE = 'BASE TABLE'ORDER BY TABLE_NAME;

Y eliminar el ultimo UNION y ejecutar la consulta

SELECT 'Dim_Categories' AS TABLE_NAME, COUNT(1) AS TOTAL FROM dbo.Dim_Categories UNION SELECT 'Dim_Customers' AS TABLE_NAME, COUNT(1) AS TOTAL FROM dbo.Dim_Customers UNION SELECT 'Dim_Employees' AS TABLE_NAME, COUNT(1) AS TOTAL FROM dbo.Dim_Employees UNION SELECT 'Dim_Products' AS TABLE_NAME, COUNT(1) AS TOTAL FROM dbo.Dim_Products UNION SELECT 'Dim_Time' AS TABLE_NAME, COUNT(1) AS TOTAL FROM dbo.Dim_Time UNION SELECT 'FT_Order_Details' AS TABLE_NAME, COUNT(1) AS TOTAL FROM dbo.FT_Order_Details UNION

1.2. Eliminando el contenido de todas las Dimensiones y FTs

SELECT 'DELETE ' + TABLE_NAME + '; ' AS SQL_StmtFROM INFORMATION_SCHEMA.TABLESWHERE TABLE_TYPE = 'BASE TABLE'ORDER BY TABLE_NAME

DELETE FT_Order_Details; DELETE Dim_Products; DELETE Dim_Categories; DELETE Dim_Customers; DELETE Dim_Employees; DELETE Dim_Time;

22

2 SQL Server Analysis Services (SSAS)

2.1 Objetivo general Construir un cubo en base al DW diseñado

2.2 Creando el proyecto de SSAS

23

2.3 Creando el cubo

2.3.1 New data source

24

2.3.2 New Data Source View

25

26

2.3.3 New Cube

27

28

2.3.4 Procesando el cubo

29

2.4 Navegando sobre las tablas

2.4.1 Explorando el contenido de una tabla

30

2.4.1.1 Distintas opciones al navegar en el contenido de una tabla

31

2.5 Editando una dimensión

2.6 Editando un cuboObserve que existen 10 pestañas

32

2.6.1 Cube Structure

2.6.2 Dimension Usage

2.6.3 Calculations

2.6.4 KPIs

33

2.6.5 Actions

2.6.6 Partitions

2.6.7 Aggregations

2.6.8 Perspectives

2.6.9 Translations

2.6.10 Browser

34

35

3 Pivoteando un cubo desde Excel

3.1 Creando la conexión

3.2 Acezando al cubo

3.3 Pivoteando

4 SQL Server Reporting Services (SSRS)

4.1 Creando el proyecto de SSRS

4.2 Creando un reporte cuya fuente de datos sea un cubo

36

5 Report Model Project

37

38

39

40

41

42

43

44

top related