T-Sql

Table-Valued Parameters in Action

Sergio Govoni

SQL Server 2008 recepisce una richiesta che gli sviluppatori avevano inoltrato a Microsoft già da parecchio tempo, ossia la possibilità di passare a stored procedure e function definite dall’utente, parametri di tipo tabella ovvero Table-Valued Parameters (TVPs).

Nelle precedenti versioni di SQL Server, la necessità di passare una struttura dati come parametro ad una stored procedure o ad una function veniva spesso risolta con un workaround che consiste nel passare parametri di tipo XML o Comma Separeted String. Queste soluzioni, tipicamente, richiedono però la stesura di parecchio codice T-SQL che difficilmente potrà scalare in modo ottimizzato in funzione della quantità dei dati trattati.

Le basi di dati spiegato a mia nonna

Davide Mauri

Scheda del libro:

Autore: Mario De Ghetto
Prezzo: Euro 35,00
Caratteristiche: Pagine 384 pag - 17x24 bn
Numero Edizione 1
Anno di edizione: 2010
Argomento: Informatica
ISBN: 9788882338220
Lingua: Italiana
Collana: digital lifestyle pro

Le basi dati sono fondamentali per quelle applicazione che devono gestire diverse informazioni. Il libro Le basi di Dati spiegato a mia nonna http://www.***.it/scheda.aspx?ID=31657 , edito della casa editrice *** http://www.***.it ,   fornisce in maniera esauriente e molto semplice il funzionamento dei database. L’autore del libro, Mario De Ghetto,  propone anche per questo libro una spiegazione molto semplice e curata per coloro che  non hanno dimestichezza con le base dati. La formula utilizzata è la stesa dei precedenti libri che ha pubblicato l’autore per questa casa editrice. Con la frase “Spiegate a mia nonna” fa comprendere come il libro tratta l’argomento in maniera molto semplice per facilitarne la comprensione anche a coloro che non hanno una buona padronanza dell’informatica.

SQL Server 2008 R2 Update for Developers Training Kit (March 2010 Update 2)

Davide Mauri

Rilasciato l’Update 2 del “SQL Server 2008 R2 Update for Developers Training Kit”, package dedicato a tutti coloro che usano SQL Server 2008 e vogliono fare un pò di training per usarlo al meglio:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=fffaad6a-0153-4d41-b289-a3ed1d637c0d 

Il contenuto è estramamente interessante:

  • Presentations (15)
    • SQL Server 2008 R2 Update for Developers Overview Part I - SQL Server 2008 Review
    • SQL Server 2008 R2 Update for Developers Overview Part II - Introducing SQL Server 2008 R2
    • SQL Server 2008: Filestream
    • SQL Server 2008: Spatial
    • SQL Server 2008: T-SQL
    • SQL Server 2008: Date and Time Types
    • SQL Server 2008: SQLCLR
    • SQL Server 2008: Reporting Services
    • SQL Server 2008 R2: Introducing Application and Multi-Server Management with SQL Server 2008 R2 and Visual Studio 2010
    • SQL Server 2008 R2: Working with Data Tier Application Projects in Visual Studio 2010
    • SQL Server 2008 R2: Managing Change in Data Tier Application Projects with Visual Studio 2010 and SQL Server 2008 R2
    • SQL Server 2008 R2: Introducing SQL Server 2008 R2 StreamInsight
    • SQL Server 2008 R2: Querying Events in SQL Server 2008 R2 StreamInsight
    • SQL Server 2008 R2: Designing SQL Server 2008 R2 StreamInsight Event Models and Adapters
    • SQL Server 2008 R2: Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine
  • Demos (24)
    • SQL Server 2008: AdventureWorks Racing All-Up Demo
    • SQL Server 2008: Spatial Demo
    • SQL Server 2008: Spatial Types
    • SQL Server 2008: Introduction to Filestream
    • SQL Server 2008: SQL CLR Nullable Types
    • SQL Server 2008: Programming with Filestream
    • SQL Server 2008: Reporting Services Web Application Integration
    • SQL Server 2008: T-SQL Date and Time Support
    • SQL Server 2008: T-SQL Table-Valued Parameters
    • SQL Server 2008: T-SQL Row Constructors
    • SQL Server 2008: T-SQL Grouping Sets
    • SQL Server 2008: T-SQL Merge
    • SQL Server 2008 R2: Creating a Utility Control Point
    • SQL Server 2008 R2: Enrolling a Managed Instance
    • SQL Server 2008 R2: Creating Data-Tier Applications
    • SQL Server 2008 R2: Data-Tier Application Deployment
    • SQL Server 2008 R2: Managing Change in Data Tier Application Projects in Visual Studio 2010
    • SQL Server 2008 R2: Introducing SQL Server 2008 R2 StreamInsight
    • SQL Server 2008 R2: Querying Events in SQL Server 2008 R2 StreamInsight
    • SQL Server 2008 R2: Advanced SQL Server 2008 R2 StreamInsight Event Queries
    • SQL Server 2008 R2: Working with SQL Server 2008 R2 StreamInsight CTI Events and Advance Time Settings
    • SQL Server 2008 R2: Creating a SQL Server 2008 R2 StreamInsight Input Adpater
    • SQL Server 2008 R2: Choosing a SQL Server 2008 R2 StreamInsight Development Model
    • SQL Server 2008 R2: Using the SQL Server 2008 R2 StreamInsight Event Flow Debugger
  • Hands-on Labs (13)
    • SQL Server 2008: How to build your first Web Application with SQL Server and ASP.NET
    • SQL Server 2008: Using Spatial Data in TSQL
    • SQL Server 2008: Using Spatial Data in Managed Code
    • SQL Server 2008: Using SQL CLR in SQL Server 2008
    • SQL Server 2008 R2: Introduction to PowerPivot
    • SQL Server 2008 R2: Introduction to Reporting Services Improvements
    • SQL Server 2008 R2: Introduction to StreamInsight and Complex Event Processing
    • SQL Server 2008 R2: Introduction to Data-tier Applications
    • SQL Server 2008 R2: Creating and Deploying a Data-Tier Application
    • SQL Server 2008 R2: Managing Change in Data-Tier Application Projects in Visual Studio 2010
    • SQL Server 2008 R2: Querying Events in SQL Server 2008 R2 StreamInsight using LINQ
    • SQL Server 2008 R2: Working with the SQL Server 2008 R2 StreamInsight Samples
    • SQL Server 2008 R2: Working with the SQL Server 2008 R2 StreamInsight Event Flow Debugger
  • Videos (35)
    • SQL Server 2008 R2 Update for Developers Overview Part I - SQL Server 2008 Review
    • SQL Server 2008 R2 Update for Developers Overview Part II - Introducing SQL Server 2008 R2
    • Introducing SQL Server 2008 R2 StreamInsight
    • Demo: Real Time Analytics with SQL Server 2008 R2 StreamInsight
    • Introducing SQL Server 2008 R2 Application and Multi-Server Management
    • Introducing SQL Server 2008 R2 Reporting Services
    • Introduction To SQL Server 2008 R2 StreamInsight and Complex Event Processing
    • Introducing PowerPivot for Excel 2010 and SharePoint 2010
    • Presentation: Introducing Application and Multi-Server Management with SQL Server 2008 R2 and Visual Studio 2010
    • Demo: Creating a Utility Control Point
    • Demo: Enrolling a Managed Instance
    • Presentation: Working with Data Tier Application Projects in Visual Studio 2010
    • Demo: Creating Data-Tier Applications
    • Demo: Data-Tier Application Deployment
    • Presentation: Managing Change in Data Tier Application Projects with Visual Studio 2010 and SQL Server 2008 R2 (Part I)
    • Presentation: Managing Change in Data Tier Application Projects with Visual Studio 2010 and SQL Server 2008 R2 (Part II)
    • Demo: Managing Change in Data Tier Application Projects in Visual Studio 2010
    • Presentation: Introducing SQL Server 2008 R2 StreamInsight (Part I)
    • Presentation: Introducing SQL Server 2008 R2 StreamInsight (Part II)
    • Demo: Introducing SQL Server 2008 R2 StreamInsight
    • Presentation: Querying Events in SQL Server 2008 R2 StreamInsight (Part I)
    • Presentation: Querying Events in SQL Server 2008 R2 StreamInsight (Part II)
    • Demo: Querying SQL Server 2008 R2 StreamInsight Using LINQ
    • Presentation: Querying Events in SQL Server 2008 R2 StreamInsight (Part III)
    • Demo: Advanced SQL Server 2008 R2 StreamInsight Event Queries
    • Presentation: Designing SQL Server 2008 R2 StreamInsight Event Models and Adapters (Part I)
    • Presentation: Designing SQL Server 2008 R2 StreamInsight Event Models and Adapters (Part II)
    • Demo: Working with SQL Server 2008 R2 StreamInsight CTI Events and Advance Time Settings
    • Presentation: Designing SQL Server 2008 R2 StreamInsight Event Models and Adapters (Part III)
    • Demo: Creating a SQL Server 2008 R2 StreamInsight Input Adapter
    • Presentation: Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine (Part I)
    • Presentation: Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine (Part II)
    • Demo: Choosing a SQL Server 2008 R2 StreamInsight Development Model
    • Presentation: Installing, Deploying and Maintaining the SQL Server 2008 R2 StreamInsight Runtime Engine (Part III)
    • Demo: Using the SQL Server 2008 R2 StreamInsight Event Flow Debugger

MERGE Statements in Action

Sergio Govoni

SQL Server 2008 introduce il supporto al comando MERGE. Questo comando permette di specificare una tabella sorgente (source) ed una tabella destinazione (target o destination), modificando il contenuto della tabella destinazione con i dati della tabella sorgente.

Potranno essere eseguite operazioni DML multiple (INSERT/UPDATE/DELETE) in funzione delle condizioni logiche specificate nelle clausole del comando. SQL Server implementa tutte le caratteristiche del comando MERGE standard ANSI e aggiunge alcune importanti estensioni disponibili solo nel linguaggio T-SQL.

Bill Of Materials problem (part three: using HIERARCHYID data type)

Sergio Govoni

Nell’articolo Recursive CTE and Bill Of Materials problem abbiamo largamente parlato delle tecnologie che SQL Server mette a disposizione per ottenere l’esplosione scalare di una distinta materiali, ossia per risolvere il problema noto come “The Bill Of Materials problem”.

Successivamente, nell’articolo Recursive CTEs and Bill Of Materials problem (part two: cyclic references) , per la stessa distinta materiali, abbiamo illustrato una soluzione in grado d’individuare riferimenti ciclici (nei dati) con prestazioni ragionevoli. Per rilevare i riferimenti ciclici abbiamo utilizzato una CTE ricorsiva in cui viene calcolato dinamicamente il path di ogni elemento. Nella SELECT ricorsiva abbiamo utilizzato il predicato LIKE per verificare che l’ID del sotto insieme (elemento) che si sta elaborando non sia già contenuto nel path composto con i riferimenti univoci (IDs) dei sotto insiemi (elementi) a livello superiore.