cnug day of.net: october 30th sql server 2005: a developers introduction shawn wildermuth magenic...

22
CNUG Day of .NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc.

Upload: ernest-harrell

Post on 27-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

CNUG Day of .NET: October 30th

SQL Server 2005: A Developers Introduction

Shawn Wildermuth

Magenic Technologies, Inc.

Page 2: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Agenda

• Who Am I?• Database Engine Enhancements• CLR Integration• InProc Managed Provider• CLR Type System• XML Changes• XML Type System• Improved Tools• Service Broker• Changes to Managed Provider (Out of Proc)

Page 3: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Who Am I?

• Shawn Wildermuth ([email protected])• Senior Consultant with Magenic Technologies• http://adoguy.com• C# MVP• INETA Speaker• Book Author

– “Pragmatic ADO.NET”; – Co-author of “Programming SQL Server 2005”

• Editor of http://ONDotnet.com• This Presentation can be found at:

– http://adoguy.com/presentations

Page 4: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Who is ESS Magenic

• Company Background

– 175+ consultants

– 10 years in business

– Regional offices

• Boston, Atlanta, Minneapolis, San Francisco, Chicago

– Gold Certified in E-Business, Business Intelligence and Microsoft Business Solutions

• .NET Experts

• Authored 40+ books on .NET

• Working with .NET since alphas

• Microsoft Server Products Experts: Sharepoint Portal, BizTalk, SQL Server, Commerce Server, Content Management Server

• Several development efforts for a variety of Microsoft’s divisions

Page 5: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

SQL Server 2005

• New Version of SQL Server– Planned to be deliver in 2nd half of 2005 (with crossed fingers)

– More than just .NET integration

– All features noted here are valid in Beta 2

– MS can pull/add features at any time though

• What didn’t make it– No row-level security (boo…hiss)

– New temporal datatypes (Date, Time, UDT Time)

Page 6: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Engine Enhancements

• New DataTypes– XML Datatype

– CLR DataTypes

Page 7: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Engine Enhancements (2)

• T-SQL Changes– New Exception Handling (TRY…CATCH)– Changes to TOP syntax

• Including calculated TOP numbers and use in UPDATE and DELETE

– Common Table Expressions (CTE)• Clearer way to make local Temp Tables and recursive queries

– New APPLY clause• Allows a table-valued function to be called on all rows of a table

– New Security Context• E.g. CREATE PROC spRunMe WITH EXECUTE AS OWNER

– DDL Triggers• Allows CREATE/ALTER/DROP commands

Page 8: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Engine Enhancements (3)

• Data Storage Changes– Materialized Views

• Allows Custered Indexes on Views to pre-compute a view

– Persisted Computed Columns

– Unified Large Object Types (e.g. varchar(max) instead of text)

– Added ALTER INDEX

– Non-Key columns can be added to indexes (partially clustered)

Page 9: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Engine Enhancements (4)

• Full-Text Engine – Now has DDL statements

• e.g. CREATE FULLTEXT INDEX …

– Can backup and restore catalogs

– Can include catalogs in attach/detaching of databases

– Supports Internationalization

– New Thesaurus support

Page 10: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Engine Enhancements (5)

• Other engine changes:– MARS Support (multiple resultsets from a single connection)

– HTTP SOAP Access through new ENDPOINTS• Like SQL XML but supported through DDL statements

– Database Mirroring• Way to handle fail-over without clustering

– Support for Catalog Views• Can now query TABLES, VIEWS, INDEXES, etc.

• Supports backward compatible sys.systables, but is depreciated

Page 11: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

CLR Integration

• Consists of two pieces:– Managed Code

– Managed Types

– Improved Hosting Environment• Hosting was created for an ASP.NET environment

• SQL Server’s requirements are completely opposite

Page 12: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

CLR Integration

• Managed Code– Stored Procedures/Functionsclass Foo { public static void Method1() { }}

CREATE ASSEMBLY UtilitiesFROM ‘C:\assemblies\utilities.dll’

CREATE PROCEDURE Method1AS EXTERNAL NAME Utils:Foo::Method1

exec Utils:Foo::Method1

Page 13: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

CLR Integration (2)

• Other Managed Code– Managed Triggers

• Can be managed code like sprocs and functions

– Custom Aggregates• Managed Code that aggregate rows in different ways

• Finally a way to write your own MAX, AVG, etc. aggregates

Page 14: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

In Proc Managed Provider

• SQL Server Managed Provider for Managed Code– Used inside the Server for access to data:

//using System.Data.SqlServer;

SqlConnection conn = SqlContext.GetConnection()SqlCommand cmd = conn.CreateCommand();cmd.CommandText = "SELECT * from authors";

SqlDataReader r = cmd.ExecuteReader();while (r.Read()) { Console.WriteLine("{0} ", r["au_lname"]);}

r.Close();

Page 15: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

CLR Datatypes

• Can store .NET Types in database tables– Information can be indexed

– Lots of limitations• Must support the concept of NULL.

• Must support conversion to and from a string representation.

• Must define the mechanism with which its state is serialized.

• Must have a default (parameterless) constructor.

• Must conform to SQL Naming rules (128 character maximum).

• Cannot be more than 8K in size.

Page 16: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

XML Changes

• FOR XML Changes– Now Supports XSD

– Can return new XML datatype

– More support for handling of nulls in XML creation

Page 17: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

XML Changes (2)

• XML Datatype– Allowed for local variables as well as column types

– Supports XPath/XQuery searches

– Supports in-line modification of XML documents• No need to get entire document just to add/delete/modify an element

– Support multiple types of XML Indexes• By Path, node name or property names

Page 18: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

XML Changes (3)

• Supports Typed XML– Supports specifying an XSD as an XML type

– Will validate XSD on storing XML data in tables

– Not as memory restrictive as CLR Types (can be over 8K)

Page 19: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Service Broker

• Reliable Messaging System inside the Database– Built-in support for asynchronous operations

– Guaranteed delivery like MSMQ

– Endpoints do not have to exist on local machine

Page 20: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Service Broker (2)

• Service Broker Components– Messages

• Bits of information that describe an operation

– Contracts• An agreement to what a message will consist of

– Queues• FIFO stores for messages

– Services• Code that handles a message out of a Queue

Page 21: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Service Broker (3)

• Other Service Broker Services– Conversation Management (discussions between services)

– Transactional Support

– Orchestration of Multiple Conversations

– Security

Page 22: CNUG Day of.NET: October 30th SQL Server 2005: A Developers Introduction Shawn Wildermuth Magenic Technologies, Inc

Questions?Questions?