La presentazione è in caricamento. Aspetta per favore

La presentazione è in caricamento. Aspetta per favore

La Piattaforma Applicativa

Presentazioni simili


Presentazione sul tema: "La Piattaforma Applicativa"— Transcript della presentazione:

1 La Piattaforma Applicativa
3/29/2017 6:35 AM Sql Server 2005 Davide Mauri Factory Software La Piattaforma Applicativa © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

2 Agenda T-SQL XML Ranking / Top n CTE Pivot / Unpivot Try … Catch
3/29/2017 6:35 AM Agenda T-SQL Ranking / Top n CTE Pivot / Unpivot Try … Catch Encryption XML Xml data type XQuery Full Text Search © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

3 Agenda Integration Services Reporting Services Data e Control Flow
3/29/2017 6:35 AM Agenda Integration Services Data e Control Flow Connections Task Transformations Reporting Services Report Manager Sviluppo dei report con Visual Studio Report Builder © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

4 3/29/2017 6:35 AM T-SQL © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

5 FUNZIONI di RANKING RANK DENSE_RANK NTILE ROW_NUMBER 3/29/2017 6:35 AM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

6 3/29/2017 6:35 AM RANK Ritona il “posizionamento” di ogni riga all’interno di una partizione PARTITION BY definisce il criterio di partizionamento ORDER BY stabilisce l’ordine in cui viene appicato il rank alle righe Sintassi: SELECT select_list, RANK() OVER (PARTITION BY col1 ORDER BY col2) as rank FROM Tabella1 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

7 RANK RANK = 1 + numero di rank che precedono la riga
3/29/2017 6:35 AM RANK RANK = 1 + numero di rank che precedono la riga Se due o più righe sono alla pari, ricevono lo stesso rank I rank potrebbero non essere numeri consecutivi © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

8 DENSE_RANK RANK = 1 + numero di DISTINCT rank che precedono la riga
3/29/2017 6:35 AM DENSE_RANK RANK = 1 + numero di DISTINCT rank che precedono la riga Se due o più righe sono alla pari, ricevono lo stesso rank Non vi sono “gap” nei rank SELECT select_list, DENSE_RANK() OVER (PARTITION BY col1 ORDER BY col2) as rank FROM Tabella1 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

9 3/29/2017 6:35 AM NTILE Distribuisce le righe di una partizione ordinata in uno specificato numero di gruppi Se il numero di righe non è divisibile per il numero di gruppi I gruppi avranno ampiezza differente Prima compariranno i gruppi con più elementi SELECT select_list, NTILE(nr_gruppi) OVER (PARTITION BY col1 ORDER BY col2) as rank FROM Tabella1 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

10 3/29/2017 6:35 AM ROW_NUMBER Ritorna il numero sequenziale di una riga all’interno di una partizione ordinata SELECT select_list, ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) as rank FROM Tabella1 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

11 TOP Specifica che solo la prima parte di un result set verrà ritornata
3/29/2017 6:35 AM TOP Specifica che solo la prima parte di un result set verrà ritornata PERCENT WITH TIES (+ order by) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

12 COMMON TABLE EXPRESSION (CTE)
3/29/2017 6:35 AM COMMON TABLE EXPRESSION (CTE) Result set temporaneo Non è salvato come oggetto Rimane in vita solo per la durata della query che lo ospita Migliora la leggibilità e la manutenibilità delle query © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

13 CTE: Utilizzo Query ricorsive
3/29/2017 6:35 AM CTE: Utilizzo Query ricorsive Anchor Member e Recursive Member Quert hint: option (maxrecursion n) Sostituto delle view (quando non serve salvare i metadati) Referenziare lo stesso result set più volte nella query © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

14 CTE: Sintassi Struttura della CTE: Utilizzo:
3/29/2017 6:35 AM CTE: Sintassi Struttura della CTE: WITH nome_cte [(nome colonna,…)] AS (query che definisce la CTE) Utilizzo: SELECT * FROM nome_cte © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

15 3/29/2017 6:35 AM PIVOT Ruota un’espressione tabellare trasformando i valori univoci di una colonna nelle colonne dell’espressione di output Effettua le aggregazioni che costituiscono l’output SELECT VendorID, [164] AS Emp1, [198] AS Emp2, [223] AS Emp3, [231] AS Emp4 FROM ( SELECT PurchaseOrderID, EmployeeID, VendorID FROM Purchasing.PurchaseOrderHeader ) p PIVOT( COUNT (PurchaseOrderID) FOR EmployeeID IN ( [164], [198], [223], [231] )) AS pvt © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

16 UNPIVOT Effettua l’operazione inversa rispetto a PIVOT
3/29/2017 6:35 AM UNPIVOT Effettua l’operazione inversa rispetto a PIVOT Ruota le colonne in righe I valori nulli non possono essere usati SELECT VendorID, Employee, Orders FROM (SELECT VendorID, Emp1, Emp2, Emp3, Emp4 FROM pvt) p UNPIVOT (Orders FOR Employee IN (Emp1, Emp2, Emp3, Emp4, Emp5) )AS unpvt GO © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

17 Error handling Gestione simile al C# / VB.NET attraverso TRY e CATCH:
3/29/2017 6:35 AM Error handling Gestione simile al C# / VB.NET attraverso TRY e CATCH: Se si verifica un errore nel blocco TRY il controllo passa al blocco CATCH. Eseguito il blocco CATCH il controllo passa al codice che sta dopo END CATCH Blocco TRY Exception Blocco CATCH Codice Successivo a END CATCH Nessuna Exception © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

18 Sintassi di TRY...CATCH Sintassi: BEGIN TRY ... END TRY BEGIN CATCH
3/29/2017 6:35 AM Sintassi di TRY...CATCH Sintassi: BEGIN TRY ... END TRY BEGIN CATCH Gestione dell’errore ..... END CATCH Il batch è unico!!!! © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

19 3/29/2017 6:35 AM Try...catch TIPS Ogni TRY..CATCH deve essere contenuto in un unico BATCH, Stored Procedure, Trigger I blocchi TRY…CATCH possono essere nidificati Errori con severity <= 10 sono warning che non vengono intercettati dal blocco CATCH Errori con severity >= 20 che causano l’interruzione della connessione: Non sono gestiti da TRY…CATCH Tuttavia finchè la connessione non è interrotta il blocco CATCH funziona. © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

20 3/29/2017 6:35 AM Try...catch e XACT_STATE Nel blocco catch è bene controllare lo stato della transazione attraverso XACT_STATE() 1: Transazione attiva, la sessione può compiere qualsiasi azione (COMMIT o ROLLBACK) 0: Nessuna transazione attiva -1: Esiste una transazione aperta, ma NON può essere eseguito il COMMIT. BEGIN CATCH IF (XACT_STATE()) = -1 ROLLBACK TRANSACTION; IF (XACT_STATE()) = 1 COMMIT TRANSACTION; END CATCH © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

21 Informazioni sugli errori
3/29/2017 6:35 AM Informazioni sugli errori ERROR_MESSAGE() ERROR_NUMBER() ERROR_SEVERITY() ERROR_STATE() ERROR_PROCEDURE() ERROR_LINE() Ritornano informazioni solo all’interno di un blocco CATCH. Posso utilizzate una stored procedure per il logging © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

22 TRY...CATCH: tips Utilizzo di RAISERROR per il rethrow Intercetta:
3/29/2017 6:35 AM TRY...CATCH: tips Utilizzo di RAISERROR per il rethrow Intercetta: Deadlock errors Non intercetta: Errori di compilazione tipo syntax error Statement level recompilation errors (object name resolution errors) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

23 ENCRYPTION Possibilità di criptare i valori tramite l’utilizzo di
EncryptKey DecryptKey Utilizzabili negli statement DML Solo chi è in possesso della chiave giusta potrà vedere il valore Gli altri vedranno NULL © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

24 3/29/2017 6:35 AM XML © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

25 XML in un Database Relazionale?
3/29/2017 6:35 AM XML in un Database Relazionale? E’ lo standard de facto Utilizzato come Lingua Franca Dati trasmessi e ricevuti come XML Sempre più utilizzato I database prima o poi devono cominciare a fare i conti con questa realtà Allora meglio farlo nel modo migliore © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

26 XML in un Database Relazionale?
3/29/2017 6:35 AM XML in un Database Relazionale? XML può vivere all’interno del db in 3 modi 1. TEXT Come accade con Sql Server 2000 Si perdono le funzionalità intrinsche di XML © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

27 XML in un Database Relazionale?
3/29/2017 6:35 AM XML in un Database Relazionale? 2. RELATIONAL FORMAT Se possibile un documento può essere scomposto in tabelle Si sfruttano le capacità del motore relazionale Si ottiene tramite OPENXML o XMLBULKLOAD (SqlXml) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

28 XML in un Database Relazionale?
3/29/2017 6:35 AM XML in un Database Relazionale? 3. XML Data Type Utilizzo di tutte le funzionalità di xml Supporto ricerche full-text Supporto validazione Utilizzabile in ogni situazione Colonne, Parametri, Variabili, Return Value Attenzione non abusarne Violazione della forma normale © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

29 XML in un Database Relazionale?
3/29/2017 6:35 AM XML in un Database Relazionale? Perchè dovrei?!?! Memorizzazione di documenti XML Memorizzazione di dati destrutturati Sistemi Integrati B2B (Business To Business)/B2C (Business To Consumer) A2A (Application To Application) Messaging (SOAP) Occhio a non sentirsi “obbligati” Ogni tanto la si cerca di usare solo perchè è nuova o perchè non si conoscono alternative  © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

30 XML in un Database Relazionale
3/29/2017 6:35 AM XML in un Database Relazionale Una colonna XML può memorizzare well-formed XML Fragments Documents © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

31 XML in un Database Relazionale
3/29/2017 6:35 AM XML in un Database Relazionale Pieno supporto e gestione dell’encoding -- This works correctly INSERT INTO xml_tab VALUES(4, '<?xml version="1.0" encoding="utf-8"?> <doc1> <row au_id=" "/> </doc1>') -- This fails, encoding does not agree w/variable type INSERT INTO xml_tab VALUES(5, N'<?xml version="1.0" encoding="utf-8"?> <row au_id=" "></row> © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

32 3/29/2017 6:35 AM Typed & Untyped XML E’ possibile fare in modo che il tipo XML sia validato da un XML Schema Per validare i dati inseriti Per assicurarsi che tutte le entità abbiano la stessa struttura Definizione dei tipi di dati utilizzati © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

33 Constrained XML E’ possibile anche utilizzare il vincolo CHECK
3/29/2017 6:35 AM Constrained XML E’ possibile anche utilizzare il vincolo CHECK Constrained XML CREATE TABLE docs ( pk INT PRIMARY KEY, xCol XML not null CONSTRAINT CK_name CHECK (xCol.exist('/book/author[first-name = last-name]') = 0) ) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

34 XML Schema Collections
3/29/2017 6:35 AM XML Schema Collections Gli XML Schema utilizzati devono essere nel database CREATE XML SCHEMA COLLECTION Il nome verrà utilizzato nell’associazione con il tipo di dato Lo schema deve essere inserito come literal © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

35 XML Schema Collections
3/29/2017 6:35 AM XML Schema Collections CREATE XML SCHEMA COLLECTION geocoll literal schema '<xs:schema ... targetNamespace targetNamespace = urn:geo> ... </xs:schema>' CREATE TABLE Locations reference to ( schema collection location xml(geocoll) ... ) Memorizzazione nella tabelle di sistema sys.xml_schema_collections sys.xml_schema_namespaces © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

36 XML Schema Sample f or namespace urn:geo similar to sql type,
<xs:schema xmlns:xs= "http://www.w3.org/2001/XMLSchema" targetNamespace="urn:geo" xmlns:tns="urn:geo"> <xs:simpleType name="dim"> <xs:restriction base="xs:int"/> </xs:simpleType> <xs:complexType name=" Point "> <xs:sequence> <xs:element name="X" type="tns:dim"/> <xs:element name="Y" </xs:sequence> </xs:complexType> <xs:element name="Point" type="tns: "/> </xs:schema> f or namespace urn:geo similar to sql type, structured type, i.e. a tree element that might appear in xml data © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

37 Utilizzo di Typed XML CREATE TABLE point_tab(
3/29/2017 6:35 AM Utilizzo di Typed XML CREATE TABLE point_tab( id int IDENTITY primary key, -- geocoll include schema for 'urn:geo' namespace thepoint xml(CONTENT, geocoll) GO -- this works, schema-valid Point INSERT INTO point_tab VALUES( '<Point xmlns="urn:geo"><X>10</X><Y>20</Y></Point>') -- this insert fails, value foo is not a dim (integer) '<Point xmlns="urn:geo"><X>10</X><Y>foo</Y></Point>') © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

38 XML Schema Collections
3/29/2017 6:35 AM XML Schema Collections L’ XML schema non è realmente memorizzato nel database Il contenuto è scomposto e memorizzato in tabelle di sistema Solo le imformazioni fondamentali vengono memorizzate Informazioni non memorizzate Comments, Processing Instructions <xs:annotation> © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

39 XML Schema Collections
3/29/2017 6:35 AM XML Schema Collections Ottenere lo schema memorizzato sys_schema_namespace(…, …) Non è lo schema orginale Ma è Functionally Equivalent select xml_schema_namespace(N’dbo’, N’geocollection’) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

40 FOR XML Risultato memorizzabile in una varibile
3/29/2017 6:35 AM FOR XML Risultato memorizzabile in una varibile Tramite la keywork TYPE Nuova keywork PATH per effettuare lo shaping dell’XML Più semplice da usare che EXPLICIT xml = SELECT * FROM authors FOR XML AUTO, TYPE © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

41 FOR XML SELECT au_id as [@authorid], au_fname as [name/firstname],
au_lname as [name/lastname] FROM authors FOR XML PATH <!– one row per selected row --> <row authorid=" "> <name> <firstname>Bob</firstname> <lastname>Smith</lastname> </name> </row> ... © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

42 XML BULK LOAD I dati XML possono essere popolati tramite BULK LOAD
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

43 XQuery XQuery è l’evoluzione di XPath Supporto di un subset di XQuery
3/29/2017 6:35 AM XQuery XQuery è l’evoluzione di XPath Più correttamente è un SuperSet Supporto di un subset di XQuery implementazione basata con il draft Novembre 2003 Permette di poter fare query su dati semistrutturati e/o destrutturati XML  © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

44 XQuery XQuery fatta da “FLWOR” Expressions:
3/29/2017 6:35 AM XQuery XQuery fatta da “FLWOR” Expressions: FOR LET (not supported) WHERE ORDER BY RETURN Può lavorare direttamente sull’ XML Data Type sia come variabile sia come colonna © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

45 XQuery Possibilità di utilizzare sia query XPath che FLWOR
3/29/2017 6:35 AM XQuery Possibilità di utilizzare sia query XPath che FLWOR (: this is a valid XQuery :) /people/person[age > 30] (: so is this FLWOR expression :) for $p in /people/person where $p/age > 30 order by $p/age[1] return $p/name © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

46 XQuery -- returns <li>moe in record number x</li>
3/29/2017 6:35 AM XQuery -- returns <li>moe in record number x</li> -- where x is the ID column, or blank column SELECT xml_col.query(' for $b in //person where return <li>{ } in record number {sql:column("xml_tab.id")}</li> ') FROM xml_tab -- returns <li>moe is a stooge</li> VARCHAR(50) = ' is a singer' SELECT xml_col.query(' for $b in //person where return <li>{ } }</li> ') FROM xml_tab © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

47 XQuery & Xml Data Type Xml Data Type Functions exist() value() query()
3/29/2017 6:35 AM XQuery & Xml Data Type Xml Data Type Functions exist() value() query() nodes() modify() SELECT xmlCol.query(‘/Root/ProdDesc/*’) FROM myTable © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

48 xml.exist() xml.exist usa XML type and XQuery expression
3/29/2017 6:35 AM xml.exist() xml.exist usa XML type and XQuery expression false se la query restituisce NULL true negli altri casi Può essere utilizzato in constraint di tipo CHECK © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

49 xml.exist() Supporto per DEFAULT -- pdoc must have a person element
3/29/2017 6:35 AM xml.exist() -- pdoc must have a person element -- as a child of the people root CREATE TABLE xmltab( id INTEGER PRIMARY KEY, pdoc XML CHECK (pdoc.exist('/people/person')=1) ) -- ok insert xmltab values( 1, '<people><person name="bob"/></people>') -- fails, no persons insert xmlpeople values( 2, '<people><emp name="fred"/></people>') Supporto per DEFAULT © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

50 3/29/2017 6:35 AM xml.value() xml.value restituisce un tipo di dato nativo SQL Server e scalar input: XQuery, SQL Type restituisce un tipo scalare o NULL non può restituire un tipo XML Utilizzo predicati (es. WHERE Clause) result values views © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

51 xml.value() -- insert some rows INSERT xml_tab
3/29/2017 6:35 AM xml.value() -- insert some rows INSERT xml_tab VALUES('<people><person name=“alessandro"/></people>') VALUES('<people><person name=“davide"/></people>') VALUES('<people><person name=“franco"/></people>') -- this query SELECT id, AS name FROM xml_tab -- yields this resultset id name alessandro davide franco © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

52 xml.query() xml.query resituisce un XML data type input: XQuery
3/29/2017 6:35 AM xml.query() xml.query resituisce un XML data type input: XQuery l’xml risultante può essere un XML Fragment può costruire nuovi elementi <Invoice> <LineItem>Soda</LineItem> Colonna Invoice, Tabella Invoices <LineItem>Ice</LineItem> </Invoice> SELECT invoice.query('Invoice/LineItem') FROM Invoices <LineItem>Soda</LineItem><LineItem>Ice</LineItem> © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

53 xml.nodes() scompone il contenuto di un XML data type
3/29/2017 6:35 AM xml.nodes() scompone il contenuto di un XML data type simile (concettualmente) a value(), ma produce dei nodi, non un valore scalare il risultato è un rowset il risultato può essere application al comando T-SQL CROSS APPLY si ottengono funzionalità simili ad OPENXML performance migliori © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

54 3/29/2017 6:35 AM xml.nodes() --input xml in <row id=“1”><name>alessandro</name><name>davide</name></row> <row id=“2”><name>franco</name></row> <row id=“3/> -- this query SELECT ... FROM @x.nodes(‘//row’) T(rows) -- yields this resultset id name alessandro davide franco © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

55 Using Relational Data in XQuery
3/29/2017 6:35 AM Using Relational Data in XQuery SQL Server XQuery può utilizzare sia dati XML che dati relazionali sql:variable: accesso a variabili T-SQL sql:column: accesso a columns value limitatamente alla riga in uso © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

56 Using Relational Data With XML
3/29/2017 6:35 AM Using Relational Data With XML -- returns <li>moe in record number x</li> -- where x is the ID column, or blank column SELECT xml_col.query(' for $b in //person where return <li>{ } in record number {sql:column("xml_tab.id")}</li> ') FROM xml_tab -- returns <li>moe is a stooge</li> VARCHAR(50) = ' is a stooge' SELECT xml_col.query(' for $b in //person where return <li>{ } }</li> ') FROM xml_tab © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

57 3/29/2017 6:35 AM XQuery DML © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

58 XQuery DML xml.modify permette la modifica di XML
XQuery non ha standard DML vengono utilizzati gli standard proposti insert, delete, replace operators all’interno di espressioni XQuery insert before or after element first or last sibling subelements and attributes must be a single node replace elements or attributes solo simple types “value-of" clause per aggiornare i valori © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

59 XQuery DML - Original Document
3/29/2017 6:35 AM XQuery DML - Original Document xml = '<Invoice> <InvoiceID>1000</InvoiceID> <CustomerName>Jane Smith</CustomerName> <LineItems> <LineItem> <Sku>134</Sku> <Quantity>10</Quantity> <Description>Chicken Patties</Description> <UnitPrice>9.95</UnitPrice> </LineItem> <Sku>153</Sku> <Quantity>5</Quantity> <Description>Vanilla Ice Cream</Description> <UnitPrice>1.50</UnitPrice> </LineItems> </Invoice>' © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

60 XQuery DML - Using xml.modify
3/29/2017 6:35 AM XQuery DML - Using xml.modify -- use modify to insert a subelement 'insert <InvoiceDate> </InvoiceDate> into /Invoice[1] ') -- or insert an attribute attribute status{"backorder"} -- this deletes all LineItem elements /Invoice/LineItems/LineItem') -- change the value of the CustomerName element value of /Invoice[1]/CustomerName[1]/text()[1] with "John Smith" ') © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

61 XML Full Text Search XML filter Index e query su istanze XML
3/29/2017 6:35 AM XML Full Text Search XML filter Index e query su istanze XML Analisi sul contenuto di un token I tag (attributi inclusi) sono rimossi Sintassi — come per le altre colonne CREATE FULLTEXT INDEX ON docs (xDoc) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

62 XML Full Text Search Può essere combinata con XQuery
3/29/2017 6:35 AM XML Full Text Search Può essere combinata con XQuery Full-text search come filtro, poi XQuery search SELECT R.X.query FROM (SELECT * FROM docs WHERE contains (xDoc, 'Wrd1 Wrd2')) R(X) Supporta l’attributo xml:lang Utilizza correttamente il linguaggio SELECT * FROM docs WHERE contains (xDoc, 'Visionen', LANGUAGE 'German') © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

63 Integration Services 3/29/2017 6:35 AM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

64 Architettura ed Object Model
3/29/2017 6:35 AM Architettura ed Object Model Separazione dei package in due aree Control Flow Data Flow Modello ad oggetti facilmente estendibile basato sul .NET Framework Non limitato ai soli Custom Task © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

65 Architettura ed Object Model
3/29/2017 6:35 AM Architettura ed Object Model Supporto per sorgenti e destinazioni multiple Supporto nativo XML, SQL CE 2005, AS 2005 come sorgenti/destinazione dati Introduzione delle DTS Expression Una sorta di linguaggio interno Vagamente simile a C# © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

66 Ambiente di sviluppo BI Development Studio
Praticamente è Visual Studio Designer molto più ordinato tramite l’utilizzo di aree “tematiche” Supporto per sistemi di gestione del codice Visual SourceSafe Migliorate le capacità di debugging © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

67 Package Elements Numerosi nuovi task
3/29/2017 6:35 AM Package Elements Numerosi nuovi task Data Flow Data Preparation Workflow Sql Server Scripting Analisys Server Maintenance Aggiunto il supporto per i Containers Loop, For Each, Sequence, ecc… © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

68 Tools Wizard per: DTExecUI e DTExec DTUtil Configurazione dei Package
3/29/2017 6:35 AM Tools Wizard per: Configurazione dei Package Deployment e Update Migrazione dai DTS di SQL Server 2000 DTExecUI e DTExec Esecuzione dal prompt DTUtil Gestione dal prompt (copy, crypt, sign…) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

69 Package Management E’ possibile utilizzare dei Folder per fare ordine
3/29/2017 6:35 AM Package Management E’ possibile utilizzare dei Folder per fare ordine Logging non limitato alle trasformazioni Supporto nativo per la configurazione del package senza necessità di utilizzo dell’ambiente di editing Package Checkpointing © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

70 3/29/2017 6:35 AM Sviluppo Molti elementi permettono l’utilizzo di un “Linguaggio” interno: DTS Expressions Possibilità di creare workflow molto complessi Possibilità di gestire gli eventi (es. OnError) Programmabili ed estendibili con .NET © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

71 3/29/2017 6:35 AM Packages © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

72 Package Content Un Package può contenere: Control Flow Data Flow
3/29/2017 6:35 AM Package Content Un Package può contenere: Control Flow Task Container Data Flow Trasformations Connections Configurations Variables © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

73 Operational Surfaces Control Flow Data Flow Event Handlers
3/29/2017 6:35 AM Operational Surfaces Control Flow Data Flow Event Handlers Package Explorer Execution Results Connection Managers Properties © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

74 Control Flow Descrive l’intero processo definito dal Package
3/29/2017 6:35 AM Control Flow Descrive l’intero processo definito dal Package Organizza i task e specifica percorsi e/o precedenze Il workflow è basato sul risultato di un’espressione DTS Praticamente nessun limite alla fantasia!  © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

75 Data Flow Descrive il flusso dei dati (Pipeline)
3/29/2017 6:35 AM Data Flow Source Transform Destination Descrive il flusso dei dati (Pipeline) Specifica dettagliatamente tutto ciò che riguarda la manipolazione dei dati E’ un task del Control Flow © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

76 Connection Managers Le connessioni visualizzate in uno spazio dedicato
3/29/2017 6:35 AM Connection Managers Le connessioni visualizzate in uno spazio dedicato Non solamente dedicate ai database Es. SMTP Connection Manager, FTP Connection Manager Condivise sia dagli elementi del Control Flow che del Data Flow © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

77 Control Flow Elements Tre diversi tipi di Container:
3/29/2017 6:35 AM Control Flow Elements Tre diversi tipi di Container: Possibilità di effettuare dei loop: For Loop ForEach Loop Raggruppamento di task Sequence © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

78 3/29/2017 6:35 AM Control Flow Elements Numerosi nuovi task che evitano la scrittura di codice Data Flow Task Per la definizione dettagliata dei processi di ETL File System Task Per la gestione dei file e delle directory (Create, Copy, Move, Delete, Rename, Set Attributes) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

79 Control Flow Elements Script Task Send Mail Task FTP Task
3/29/2017 6:35 AM Control Flow Elements Script Task Esecuzione di script scritti in VB.NET Editor *finalmente* evoluto Send Mail Task Supporto SMTP (Era Ora! ) FTP Task Supporto per tutte le operazione non solo il GET © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

80 Control Flow Elements WMI Data Reader Task WMI Event Watcher Task
3/29/2017 6:35 AM Control Flow Elements WMI Data Reader Task Per ottenere informazioni da WMI WMI Event Watcher Task Per monitorare i dati di WMI e rispondere ai cambiamenti XML Task Per operare su documenti XML (XSLT, Merge, Patch, Diff, Validate, XPath) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

81 Data Flow Elements Conditional Split Transform Multicast Transform
3/29/2017 6:35 AM Data Flow Elements Conditional Split Transform Per processare una riga secondo diversi criteri Multicast Transform Permette di processare una riga più volte e con diversi meccanismi Union All Transform Prende più input e di generare un solo output © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

82 Data Flow Elements Sort Transformation Count Rows Transformation
3/29/2017 6:35 AM Data Flow Elements Sort Transformation Per ordinare le righe Count Rows Transformation Per contare le righe Derived Column Per modificare o creare colonne © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

83 Data Flow Elements Fuzzy Grouping Fuzzy Lookup Percentage Sampling
Pulisce e standardizza i dati (Es. Rimuove i duplicati) Fuzzy Lookup Pulisce ulteriormente i dati (Es. Standardizzazione, Correzione ed inserimento valori mancanti) Percentage Sampling Crea dati di prova © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

84 Data Viewers Attivi durante il debug
3/29/2017 6:35 AM Data Viewers Attivi durante il debug Permettono di interrompere l’esecuzione di un Data Flow visualizzare i dati E’ possibile vedere anche la distribuzione dei dati con l’ausilio di grafici © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

85 Reporting Services 3/29/2017 6:35 AM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

86 Reporting Services Editor Report: BI Dev. Studio
3/29/2017 6:35 AM Reporting Services Editor Report: BI Dev. Studio Non è obbligatorio in quanto il report è un file xml Però è praticamente indispensabile Creare un progetto di tipo “Report Project” Aggiungere: Data Sources Parametri Reports © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

87 3/29/2017 6:35 AM Reporting Services Ogni proprietà visibile (e non) può essere modificata tramite l’uso di expressions Il linguaggio è VB.NET In più ci sono funzioni aggiunte dall’infrastruttura di SSRS Previous RowNumber CountRows © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

88 Sviluppo E’ possibile aggiungere funzioni tramite
Codice Embedded (VB.NET) External Assembly (Qualsiasi linguaggio .NET) Per personalizzare il report è possibile utilizzare immagini Memorizzate nel report (embedded) Esterne (link) Memorizzata in un db © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

89 3/29/2017 6:35 AM Reporting Services Il Report Manager è “solamente” l’applicazione di default fornita da Microsoft Utilizza il web service per visualizzare i metadati e gestire i report I report vengono visualizzati in un IFRAME E sono chiamati tramite URL © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

90 3/29/2017 6:35 AM Reporting Services E’ possibile integrare SSRS in qualsiasi applicazione tramite Chiamate SOAP (Web Services) Chiamate via URL E’ possibile integrare il tutto con SharePoint Web part disponibile dalla SP2 dei “vecchi” RS © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

91 Reporting Services Creazione di report ad-hoc
3/29/2017 6:35 AM Reporting Services Creazione di report ad-hoc Tramite il Report Builder Non c’è un liberta “totale” I report possono essere creati sulla base di un “Report Model” Il “Report Model” contiene i metadati disponibili Più che sufficiente nel 99% dei casi Il “Report Model” si crea da Visual Studio © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

92 Reporting Services 3/29/2017 6:35 AM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

93 3/29/2017 6:35 AM Invocazione di Report E’ possibile accedere a Reporting Services in una soluzione custom in due modalita’: Url access richiesta via HTTP/GET Web Services Richiesta via SOAP © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

94 Invocazione di Report 3/29/2017 6:35 AM
© Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

95 Invocazione di Report Url Access Report Server URL Report Name
Defaults to Report Name Nome del report Report Parameters I nomi devono mappare I parametri definiti nel report Es CategoryID=1&EmployeeID=1 © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

96 Invocazione di Report Web Services Esecuzione dei report
3/29/2017 6:35 AM Invocazione di Report Web Services Esecuzione dei report GetReportParameters() Render() Anche asincrona Gestione report CreateReport() GetReportDefinition() © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

97 Distribuzione dei report
3/29/2017 6:35 AM Distribuzione dei report I report possono essere visualizzati Da web, tramite il Report Manager Da applicazioni ad hoc, o integrati in applicazioni esistenti …ma possono anche essere loro ad andare dall’interessato  Via mail Via network share Questa funzionalità prendere il nome di Subscription © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

98 Distribuzione dei report
3/29/2017 6:35 AM Distribuzione dei report Le subscription vengono eseguite in base ad una schedulazione Ad hoc Condivisa La schedulazione fa affidamento sul SQL Server Agent Quindi deve essere attivo! Vengono creati dei Job ad hoc © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

99 Distribuzione dei report
3/29/2017 6:35 AM Distribuzione dei report Distribuzione tramite network share © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

100 Distribuzione dei report
3/29/2017 6:35 AM Distribuzione dei report Distribuzione via © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

101 Distribuzione dei report
3/29/2017 6:35 AM Distribuzione dei report Le sottoscrizioni guidate (Data-Driven subscription) permettono di impostare a runtime Destinatari Parametri Formati I dati vengono prelevati tramite query ad hoc La sorgente dati, come al solito, può essere qualsiasi cosa (SQL Server, Oracle, OLEDB, ODBC) © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

102 3/29/2017 6:35 AM Domande ? © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

103 © 2004 Microsoft Corporation. All rights reserved.
3/29/2017 6:35 AM © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Scaricare ppt "La Piattaforma Applicativa"

Presentazioni simili


Annunci Google