What's New for Developers in SQL Server 2008?

  • 4,902 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Very good article to know about new features of SQL 2008
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
4,902
On Slideshare
0
From Embeds
0
Number of Embeds
8

Actions

Shares
Downloads
288
Comments
1
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Eric Nelson Developer Evangelist [email_address] – I will reply http://blogs.msdn.com/ericnel - tends to be about .NET and data http://blogs.msdn.com/goto100 - all about Visual Basic http://twitter.com/ericnel - pot luck :-) http://blogs.msdn.com/ukdevevents The ONLY LINK you need!
  • 2.
    • First PC – ZX80 in 1980 (then BBC Micro , Atari 520STFM and Macintosh LC )
    • First computer job... FORTAN in 1986
    • Wrote most LOC on... Unix using C
    • Favourite IDE of all time ... GNU Emacs
    • Joined Microsoft DRG in 1996
    • Early adoption work on ASP, SQL 6.5, MTS ...
    • Went “Back to development” in July 2008 – in VB
    • I Geek to Live (not Live to Geek)
    • I am editor of the UK MSDN Flash
    • I am fascinated by ALT.NET values and practices
    http://blogs.msdn.com/ukdevevents The ONLY LINK you need!
  • 3.
    • I live near Bath with wife, 2 kids, 1 dog (and many pet graves in the garden)
    • I originally intended to be a naval officer
    • I am very shy...seriously!
    http://blogs.msdn.com/ukdevevents The ONLY LINK you need!
  • 4.
    • Sign up to the MSDN Flash
      • Feedback, vote etc
    • Technical articles for the UK MSDN Flash
      • 400 to 500 words
    • War stories around VB6 to .NET
    • Your right (or left) arm in the air
      • NB: not all the time 
  • 5.
    • Give a flavour of the
    • new “stuff” in SQL Server 2008
    • for development
    • and
    • an insight into the direction
    • we are taking with data
  • 6.
    • TSQL Enhancements
      • SQL-2006
      • Major and minor
    • Beyond Relational
      • Filestream
      • Full text search
      • Spatial
      • Semi-structured
    • Futures*
      • Object Relational Management
      • SQL Data Services
    In one hour
  • 7.
    • Released August 6 th 2008
    • Many versions!
  • 8.  
  • 9.
      • Date & Time
    Date types
      • Table value constructor using VALUES clause
      • MERGE
      • Table Types and Table Value Parameters
      • GROUPING SET
    SQL language
      • IDE improvements
      • Compound assignment operators
      • Declaring and initializing variables
    Delighters
  • 10.
    • IDE Improvements
      • Debugging is back!
      • Intellisense has made it in
    • Compound Assignment operators: +=, -=, *=, /=
    • Variable initialization during declaration
    UPDATE Inventory SET quantity += s.quantity FROM Inventory AS i INNER JOIN Sales AS s ON i.id = s.id DECLAER @v int = 5 ; DECLARE @v1 varchar(10) = ‘xxxxx’;
  • 11.  
  • 12.
    • Insert multiple rows based on values in a single INSERT statement
    • SQL 2006 standard compatible
    INSERT INTO dbo.Customers(custid, companyname, phone, address)   VALUES   (1, 'cust 1', '(111) 111-1111', 'address 1'),   (2, 'cust 2', '(222) 222-2222', 'address 2'),   (3, 'cust 3', '(333) 333-3333', 'address 3'),   (4, 'cust 4', '(444) 444-4444', 'address 4'),   (5, 'cust 5', '(555) 555-5555', 'address 5');
  • 13.
    • Single statement that combines multiple DML operations
    • Operates on a join between source and target
    • SQL-2006 compliant
    UPDATE TGT SET TGT.quantity = TGT.quantity + SRC.quantity, TGT.LastTradeDate = SRC.TradeDate FROM dbo.StockHolding AS TGT JOIN dbo.StockTrading AS SRC ON TGT.stock = SRC.stock; INSERT INTO dbo.StockHolding (stock, lasttradedate, quantity) SELECT stock, tradedate, quantity FROM dbo.StockTrading AS SRC WHERE NOT EXISTS (SELECT * FROM dbo.StockHolding AS TGT WHERE TGT.stock = SRC.stock); MERGE INTO dbo.StockHolding AS TGT USING dbo.StockTrading AS SRC ON TGT.stock = SRC.stock WHEN MATCHED AND (t.quantity + s.quantity = 0) THEN DELETE WHEN MATCHED THEN UPDATE SET t.LastTradeDate = s.TradeDate, t.quantity += s.quantity WHEN NOT MATCHED THEN INSERT VALUES (s.Stock,s.TradeDate,s.Quantity) Pre-SQL 2008 SQL 2008
  • 14. Source Table (Stock Trading) Target Table (Stock Holding) Merged Table (Stock Holding) INSERT UPDATE DELETE
  • 15.
    • A new user defined type - Table
      • Can define indexes and constraints
    • Can be used for
      • declaring table variables
      • Input parameters of Table type on SPs/Functions
    • Optimized to scale and perform better for large data
    • Behaves like BCP inside server
    • In ADO.NET SqlDbType.Structured
    CREATE TYPE myTableType AS TABLE (id INT, name NVARCHAR(100),qty INT); CREATE PROCEDURE myProc (@tvp myTableType READONLY ) AS …
  • 16.
    • Define multiple groupings in the same query
    • Produces a single result set that is equivalent to a UNION ALL of differently grouped rows
    • SQL 2006 standard compatiable
    SELECT customerType,Null as TerritoryID,MAX(ModifiedDate) FROM Sales.Customer GROUP BY customerType UNION ALL SELECT Null as customerType,TerritoryID,MAX(ModifiedDate) FROM Sales.Customer GROUP BY TerritoryID order by TerritoryID SELECT customerType,TerritoryID,MAX(ModifiedDate) FROM Sales.Customer GROUP BY GROUPING SETS ((customerType), (TerritoryID)) order by customerType Pre-SQL 2008 SQL 2008
  • 17.  
  • 18.  
  • 19. CREATE TABLE Employee { FirstName VARCHAR(10), LastName VARCHAR(10), Birthday DATE , … } SELECT Birthday AS BirthDay FROM Employee INSERT INTO T (datetime2_col) VALUES (‘ 1541 -01-01’) INSERT INTO T (time_col) VALUES (’12:30:29 .1176548 ’) CREATE TABLE online-purchase-order { item-id int, item-name VARCHAR(30), qty int, purchase-time datetimeoffset, … } // For value ‘ 2005-09-08 12:20:19.345 -08:00 ’ INSERT INTO online-purchase-order VALUES (…., ‘ 2005-09-08 12:20:19.345 -08:00’ ,..)
      • Large year range (1~9999)
      • Storage saving
      • Easy programming
    DATE
      • Large or optional precision (0 ~ 100ns)
      • Easy programming
    TIME
      • Large year range
      • Large or optional precision
    DATETIME2
      • Datetime + time zone offset
      • UTC enabled
      • Easy programming
    DATETIME OFFSET
  • 20.  
  • 21.  
  • 22. SQL Server 2005 SQL Server 2008
    • HierarchyID
    • Large UDTs
    • Sparse Columns
    • Wide Tables
    • Filtered Indices
    • XML Upgrades
    • User Defined Types
    • XML Data Type and Functions
    • Full Text Indexing
      • Filestream
      • Integrated FTS
      • Fully supported Geometry and Geography data types and Functions
    Relational Semi Structured Documents & Multimedia Spatial
  • 23. Remote BLOB Storage FILESTREAM Storage SQL BLOB Documents & Multimedia Use File Servers DB Application BLOB Dedicated BLOB Store DB Application BLOB Store BLOBs in Database DB Application BLOB Store BLOBs in DB + File System Application BLOB DB
  • 24.
    • Storage Attribute on VARBINARY(MAX)
    • Works with integrated FTS
    • Unstructured data stored directly in the file system (requires NTFS)
    • Dual Programming Model
      • TSQL (Same as SQL BLOB)
      • Win32 Streaming APIs with T-SQL transactional semantics
    • Advantages
      • Integrated Manageability
      • SQL Server Security Stack
      • Dual model
    Documents & Multimedia Store BLOBs in DB + File System Application BLOB DB
  • 25.  
  • 26.
    • Full-Text Engine and Indexes fully integrated
      • Catalog, index and stopword lists now inside the database
    • Better performance in many common scenarios
      • Make mixed queries perform and scale
      • Optimizer has knowledge about FT index
      • SELECT * FROM candidates WHERE CONTAINS(resume,’”SQL Server”’) AND ZipCode = ‘98052’
    Documents & Multimedia
  • 27. Populating an index of 20million rows of 1k data on identical hardware (time in minutes) 2 min 1 min Documents & Multimedia
  • 28.
    • Proliferation of geographical data
      • GPS Systems, Virtual Earth, Live Search Maps etc
      • New opportunities for spatially aware apps
    • Storage and retrieval of spatial data using standard SQL
      • New Spatial Data Types + methods + indexes
        • geometry - Flat Earth (Planar)
        • geography - Round Earth (Geodetic)
    • Offers full set of Open Geospatial Consortium components
    Spatial
  • 29.  
  • 30. 1 2 3 4 5 1 3 4 5 2 // Create a Filtered Indexes // Sparse column Create Table Products(Id int, Type nvarchar(16)…, Resolution int SPARSE , ZoomLength int SPARSE ); // Filtered Indices Create Index ZoomIdx on Products(ZoomLength) where Type = ‘Camera’; // HierarchyID CREATE TABLE [dbo].[Folder] ( [FolderNode] HIERARCHYID NOT NULL UNIQUE, [Level] AS [FolderNode].GetLevel() PERSISTED, [Description] NVARCHAR(50) NOT NULL ); HierarchyID Store arbitrary hierarchies of data and efficiently query them Large UDTs No more 8K limit on User Defined Types Sparse Columns Optimized storage for sparsely populated columns Wide Tables Support thousands of sparse columns Filtered Indices Define indices over subsets of data in tables Relational Semi Structured
  • 31.  
  • 32.  
  • 33.  
  • 34.
    • What is it?
      • Technique for working with relational tables as if they were objects in memory
      • Intention is to hide away the complexity of the underlying tables and give a uniform way of working with data
    • Why use it?
      • Productivity
      • Retain database independence
    • Which ORM?
      • There are many ORMs for .NET developers already in existence. E.g.
        • LLBLGen Pro http://www.llblgen.com/
        • Nhibernate http://www.hibernate.org/343.html
        • EntitySpaces http://www.entityspaces.net/Portal/Default.aspx
  • 35.
    • LINQ to SQL
      • .NET Framework 3.5, Nov 2007
      • Only SQL Server
      • Simple
      • Easy to learn and master
    • LINQ to Entities ( ADO.NET Entity Framework )
      • .NET Framework 3.5 SP1, Aug 2008
      • “ Any” RDBMS
      • Complex
      • Easy to learn, hard to master
      • Strategic
  • 36.  
  • 37.  
  • 38. HTTP (AtomPub) Clients (Tools, Libraries, etc) SQL Data Services ADO.NET Data Services Framework SQL Server (On premises data service) (Cloud data service)
  • 39. Data Access Lib SDS Runtime REST / SOAP Data Access Lib SDS Runtime REST / SOAP Data Access Lib SDS Runtime REST / SOAP Data Access Lib SDS Runtime REST / SOAP Data Access Lib SDS Runtime REST / SOAP Data Access Lib SDS Runtime REST / SOAP Data Access Lib SDS Runtime REST / SOAP Mgmt. Services Distributed Data Fabric SQL Server Mgmt. Services Distributed Data Fabric SQL Server Mgmt. Services Distributed Data Fabric SQL Server Mgmt. Services Distributed Data Fabric SQL Server Mgmt. Services Distributed Data Fabric SQL Server Mgmt. Services Distributed Data Fabric SQL Server Mgmt. Services Distributed Data Fabric SQL Server
  • 40.
    • Unit of geo-location and billing
    • Tied to DNS name
    • Collection of Containers
  • 41.
    • Entity properties may differ in type and instance
  • 42.  
  • 43.  
  • 44.  
  • 45.  
  • 46.
    • Drop me an email if I confused you about anything!
      • [email_address]
    • http:// blogs.msdn.com/ UKDevEvents
      • Post event resources for all Microsoft UK developer focused sessions
    • The team
      • Eric Nelson http://blogs.msdn.com/ericnel
      • Mike Ormond http://blogs.msdn.com/mikeormond
      • Mike Taulty http://mtaulty.com