36
Developer Track 8

SQL Server "Yukon" and the Developer

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: SQL Server "Yukon" and the Developer

Developer Track 8

Page 2: SQL Server "Yukon" and the Developer

Tom DavidsonTom DavidsonProgram ManagerProgram ManagerSQL Server DevelopmentSQL Server DevelopmentMicrosoft CorporationMicrosoft Corporation

SQL Server “Yukon” and the Developer

Page 3: SQL Server "Yukon" and the Developer

SQL Server “Yukon”..NET FrameworkNET Framework

Common Language Runtime IntegrationCommon Language Runtime IntegrationUser-defined AggregatesUser-defined AggregatesUser-defined Data TypesUser-defined Data TypesUser-defined FunctionsUser-defined FunctionsSQL Server .NET Data ProviderSQL Server .NET Data ProviderExtended TriggersExtended Triggers

Data TypesData TypesManaged SQL TypesManaged SQL TypesNew XML DatatypeNew XML Datatype

SQL Server EngineSQL Server EngineNew Message Service BrokerNew Message Service BrokerHTTP Support (Native HTTP)HTTP Support (Native HTTP)Database Tuning Advisor Database Tuning Advisor Enhanced Read ahead & scanEnhanced Read ahead & scanExtended IndexesExtended IndexesMultiple Active Result Sets Multiple Active Result Sets Persisted Computed ColumnsPersisted Computed ColumnsQueuing SupportQueuing SupportSnapshot Isolation Level Snapshot Isolation Level Scale Up PartitioningScale Up PartitioningVIA support VIA support NUMA supportNUMA support

Database Failure and RedundancyDatabase Failure and RedundancyFail-over Clustering (up to 8 node)Fail-over Clustering (up to 8 node)Enhanced Multi-instance SupportEnhanced Multi-instance SupportDatabase MirroringDatabase MirroringDatabase ViewsDatabase Views

XMLXMLXQUERY Support (Server & Mid Tier)XQUERY Support (Server & Mid Tier)XML Data Manipulation Language XML Data Manipulation Language FOR XML EnhancementsFOR XML EnhancementsXML Schema (XSD) Support XML Schema (XSD) Support MSXML 6.0 (Native)MSXML 6.0 (Native).Net XML Framework.Net XML Framework

Database MaintenanceDatabase MaintenanceBackup and Restore EnhancementsBackup and Restore EnhancementsChecksum Integrity ChecksChecksum Integrity ChecksDedicated Administrator ConnectionDedicated Administrator ConnectionDynamic AWEDynamic AWEFast RecoveryFast RecoveryHighly-available UpgradeHighly-available UpgradeOnline Index OperationsOnline Index OperationsOnline RestoreOnline RestoreParallel DBCCParallel DBCCParallel Index OperationsParallel Index Operations

Management ToolsManagement ToolsMDX Query EditorMDX Query EditorMDX IntellisenseMDX IntellisenseT-SQL IntellisenseT-SQL IntellisenseVersion Control SupportVersion Control SupportXML/AXML/ASQLCMD Command Line ToolSQLCMD Command Line Tool

Performance TuningPerformance Tuning Profiler EnhancementsProfiler EnhancementsProfiling Analysis ServicesProfiling Analysis ServicesExportable Showplan Exportable Showplan Exportable Deadlock TracesExportable Deadlock Traces

Full-text SearchFull-text SearchIndexing of XML DatatypeIndexing of XML Datatype

MDAC MDAC Side by Side installationSide by Side installationMicrosoft Installer based setupMicrosoft Installer based setupSupport for Active Directory DeploymentSupport for Active Directory Deployment

SQL Client .NET Data ProviderSQL Client .NET Data ProviderServer Cursor SupportServer Cursor SupportAsynchAsynch

SecuritySecurityAll Permissions GrantableAll Permissions GrantableFine Grain Administration RightsFine Grain Administration RightsSeparation of Users and SchemaSeparation of Users and Schema

ReplicationReplicationAuto-tuning Replication AgentsAuto-tuning Replication AgentsOracle PublicationOracle PublicationImproved Blob Change TrackingImproved Blob Change Tracking

OLAP and Data MiningOLAP and Data MiningAnalysis Management Objects Analysis Management Objects Windows Integrated Backup and RestoreWindows Integrated Backup and RestoreWeb Service/XML for AnalysisWeb Service/XML for AnalysisDTS and DM IntegrationDTS and DM IntegrationEight new DM algorithmsEight new DM algorithmsAuto Packaging and DeploymentAuto Packaging and Deployment

Data Transformation ServicesData Transformation ServicesNew Architecture (DTR + DTP)New Architecture (DTR + DTP)Complex Control FlowsComplex Control FlowsControl Flow DebuggingControl Flow DebuggingFor Each EnumerationsFor Each EnumerationsProperty MappingsProperty MappingsFull Data Flow DesignerFull Data Flow DesignerFull DTS Control Flow DesignerFull DTS Control Flow DesignerGraphical Presentation of Pkg ExecutionGraphical Presentation of Pkg ExecutionImmediate Mode and Project ModeImmediate Mode and Project ModePackage (Advanced) Deployment ToolsPackage (Advanced) Deployment ToolsCustom Tasks and TransformationsCustom Tasks and Transformations

Reporting ServicesReporting ServicesMultiple Output Formats Multiple Output Formats Parameters (Static, Dynamic, Parameters (Static, Dynamic,

Hierarchical)Hierarchical)Bulk Delivery of Personalized ContentBulk Delivery of Personalized ContentSupport Multiple Data Sources Support Multiple Data Sources STS (Web Parts, Doc Libraries)STS (Web Parts, Doc Libraries)Visual Design ToolVisual Design ToolCharting, Sorting, Filtering, Drill-ThroughCharting, Sorting, Filtering, Drill-ThroughScheduling, CachingScheduling, CachingComplete Scripting EngineComplete Scripting EngineScale Out architectureScale Out architectureOpen XML Report DefinitionOpen XML Report Definition

Notification ServicesNotification Services

Page 4: SQL Server "Yukon" and the Developer

SQL Server “Yukon”The scalable, secure, enterprise-class data management platform

Enterprise Data ManagementEnterprise Data Management Scalability, availability, security advancementsScalability, availability, security advancements Storage of all data types, formatsStorage of all data types, formats Focus on ease-of-useFocus on ease-of-use

ProgrammabilityProgrammability Leverage existing development skills Leverage existing development skills Share data across any platformShare data across any platform Provide end-to-end development toolsProvide end-to-end development tools

Business IntelligenceBusiness Intelligence Scalable, comprehensive solutionScalable, comprehensive solution Real time decision making toolsReal time decision making tools Extend information to employees, partnersExtend information to employees, partners

Page 5: SQL Server "Yukon" and the Developer

Programmability

.NET Integration.NET Integration XML supportXML support T-SQL enhancementsT-SQL enhancements Data Access API’s enhancementsData Access API’s enhancements Developer Tools IntegrationDeveloper Tools Integration Management API’sManagement API’s

Page 6: SQL Server "Yukon" and the Developer

Programmability: Goals

.NET Integration: .NET Integration: Convergence of database and mid-tier programming modelsConvergence of database and mid-tier programming models

XML Support: XML Support: Data model evolution for storing semi-structured Data model evolution for storing semi-structured

data/documentsdata/documents T-SQL Enhancements:T-SQL Enhancements:

API’s and Languages: API’s and Languages: Modernizing the data access programming environmentModernizing the data access programming environment

Developer Tools: Developer Tools: Breakthrough integration between developer and database toolsBreakthrough integration between developer and database tools

Expanding the Engine: Expanding the Engine: Innovative technologies such as SQL Server Event Notification Innovative technologies such as SQL Server Event Notification

and SQL Server Service Brokerand SQL Server Service Broker

Page 7: SQL Server "Yukon" and the Developer

.NET Integration

Choice of where to run logicChoice of where to run logic Database, for logic that runs close to Database, for logic that runs close to

datadata Mid-tier, for logic that scales outMid-tier, for logic that scales out Symmetric programming modelSymmetric programming model

Choice of programming language Choice of programming language T-SQL, for data-intensive stored T-SQL, for data-intensive stored

proceduresprocedures CLR languages, for a safe, modern CLR languages, for a safe, modern

execution environment and for extending execution environment and for extending the enginethe engine

Page 8: SQL Server "Yukon" and the Developer

Common Language Runtime (1)

Provides .NET programmability Provides .NET programmability enhancements / extensionsenhancements / extensions

VB, C++, C#VB, C++, C# Assemblies are compiled .NET modulesAssemblies are compiled .NET modules

Consistent programming model Consistent programming model across tiers across tiers

Runs in SQL Server CLR memory Runs in SQL Server CLR memory spacespace

Page 9: SQL Server "Yukon" and the Developer

Common Language Runtime (2)

two step process consists of two step process consists of creating an assemblycreating an assembly – create assembly – create assembly

Persisted in the databasePersisted in the database DLL FileDLL File May reference other assemblies in DBMay reference other assemblies in DB

creating assembly entry point using one creating assembly entry point using one of the following:of the following:

UDF function - create functionUDF function - create function Stored procedure - create procedureStored procedure - create procedure Trigger - create triggerTrigger - create trigger UDT - create typeUDT - create type

Page 10: SQL Server "Yukon" and the Developer

.NET Stored Procedures

.NET methods registered as .NET methods registered as stored proceduresstored procedures CREATE PROCEDURE…CREATE PROCEDURE…

AS EXTERNAL NAME method_nameAS EXTERNAL NAME method_name References entry point in assemblyReferences entry point in assembly

Use In-Proc ADO .NETUse In-Proc ADO .NET Take advantage of the richness of Take advantage of the richness of

the .NET languagesthe .NET languages

Page 11: SQL Server "Yukon" and the Developer

Common Language Runtime (3)

CLR ObjectivesCLR Objectives SecuritySecurity

SQL and .NET permissionsSQL and .NET permissions Safe, External-Access (verifiable), UnsafeSafe, External-Access (verifiable), Unsafe

SpeedSpeed In process, compiledIn process, compiled

ScalabilityScalability Users, complex functions, threadingUsers, complex functions, threading

SafetySafety Type safe codeType safe code

Page 12: SQL Server "Yukon" and the Developer

Yukon Dev: Feature Overview

T-SQLT-SQL .NET .NET LanguagesLanguages

User Defined User Defined FunctionsFunctions

XX XX

Stored Stored ProceduresProcedures

XX XX

TriggersTriggers XX XXUser-Defined User-Defined TypesTypes

XX

AggregatesAggregates XX

Page 13: SQL Server "Yukon" and the Developer

In-Proc ADO .NET

Familiar programming model for Familiar programming model for ADO .NET developersADO .NET developers SqlConnection, SqlCommand, SqlConnection, SqlCommand,

SqlDataReader, …SqlDataReader, …

Server side extensionsServer side extensions SqlRequestDefinitionSqlRequestDefinition

New ISql interfaceNew ISql interface ISqlConnection, ISqlCommand, …ISqlConnection, ISqlCommand, …

Page 14: SQL Server "Yukon" and the Developer

Development Guidelines

TSQL… TSQL… For routines containing mostly data accessFor routines containing mostly data access

.NET… .NET… For CPU-intensive functions and procedures For CPU-intensive functions and procedures For implementing UDTs and UDAggsFor implementing UDTs and UDAggs For functionality currently performed by XPsFor functionality currently performed by XPs To leverage the .NET Framework (file access, To leverage the .NET Framework (file access,

image processing, XML)image processing, XML)

Page 15: SQL Server "Yukon" and the Developer

.NET .NET ProjectProject

Assembly: “TaxLib.dll”

VB,C#,C++VB,C#,C++ BuildBuild

SQL ServerSQL Server

SQL Data Definition: SQL Data Definition: create assembly … create function … create procedure … create trigger … create type …SQL Queries: SQL Queries:

select sum(tax(sal,state)tax(sal,state))from Emp where county = ‘King’

Runtime hosted by SQL

(in-proc)

The Developer Experience

Page 16: SQL Server "Yukon" and the Developer

XML Support XML benefitsXML benefits

Self-describingSelf-describing Extensible (tags, annotations, multiple schemas)Extensible (tags, annotations, multiple schemas)

provides data model flexibilityprovides data model flexibility Store structured data relationallyStore structured data relationally Store semi-structured data and documents as XML Store semi-structured data and documents as XML

Example: emailExample: email

Full integration between the two modelsFull integration between the two models SELECT both relational columns and XML valuesSELECT both relational columns and XML values Can join relational columns and XML columnsCan join relational columns and XML columns

XML provides interoperabilityXML provides interoperability Accessible over HTTP and SOAPAccessible over HTTP and SOAP Exposes all data as XMLExposes all data as XML

Platform independence for loosely coupled systemsPlatform independence for loosely coupled systems Can be programmed just like a Web serviceCan be programmed just like a Web service

Page 17: SQL Server "Yukon" and the Developer

XML Support

Native XML storageNative XML storage XML Data typeXML Data type

Typed (XML schema defined) or untyped (no schema)Typed (XML schema defined) or untyped (no schema) Tradeoff between flexibility and optimizationTradeoff between flexibility and optimization XML validation using schema constraintsXML validation using schema constraints

XML IndexXML Index Can Index XML tags to search for values efficientlyCan Index XML tags to search for values efficiently

XML query and data modificationXML query and data modification XPath, XQuery, DMLXPath, XQuery, DML

XML views on the databaseXML views on the database Maps relational to XML, XML to relationalMaps relational to XML, XML to relational Abstract the database as an XML sourceAbstract the database as an XML source

Integrated support for Web ServicesIntegrated support for Web Services HTTP, SOAP, WSDLHTTP, SOAP, WSDL

Rich XML API’s – inside and outside DBRich XML API’s – inside and outside DB

Page 18: SQL Server "Yukon" and the Developer

Example of XQuery

Return section heading of section 3 Return section heading of section 3 and beyond of document 123and beyond of document 123

SELECT xcol::query(SELECT xcol::query( 'for $s in /doc[@id = 123]//sec[@num > 3]'for $s in /doc[@id = 123]//sec[@num > 3]

return <topic>$s/heading</topic>') return <topic>$s/heading</topic>') FROM xtableFROM xtable FLWR FLWR —— FFOR/OR/LLET/ET/WWHERE/HERE/RRETURN ETURN Path expressionsPath expressions Element constructorsElement constructors Ordered operatorsOrdered operators

Page 19: SQL Server "Yukon" and the Developer

Insert, update and delete statementsInsert, update and delete statements XQuery extensions – to be standardizedXQuery extensions – to be standardized

Supports tree-level modificationsSupports tree-level modifications Add or delete sub-treesAdd or delete sub-trees Update values Update values

Add a new resume as child of root:Add a new resume as child of root:

UPDATE xtable SET xcol::modify(UPDATE xtable SET xcol::modify(

'INSERT <resume>John</resume> INTO / 'INSERT <resume>John</resume> INTO /

AS LAST')AS LAST')

XML Data Modification

Page 20: SQL Server "Yukon" and the Developer

XML Views

Default XML view of relational dataDefault XML view of relational data User-defined XML viewsUser-defined XML views

Specified using mapping schemaSpecified using mapping schema Associates XML tag with column in tableAssociates XML tag with column in table Overflow from mapping goes into XML Overflow from mapping goes into XML

data type columndata type column XQuery views on user-defined & XQuery views on user-defined &

default viewsdefault views XQuery and XML DML against viewsXQuery and XML DML against views

Does view resolutionDoes view resolution Bulk load data through XML viewsBulk load data through XML views

Page 21: SQL Server "Yukon" and the Developer

XML Support - Document Shredding

FNameFName LNameLName AddrAddr PhonePhone FaxFax XMLXML

XML Data XML Data TypeType

XMLXML

ShredShred

Views map XML And Relational data

Page 22: SQL Server "Yukon" and the Developer

XML Support - Document Query

FNameFName LNameLName AddrAddr PhonePhone FaxFax XMLXML

XQueryXQuerySQLSQL

XML Data XML Data TypeType

Page 23: SQL Server "Yukon" and the Developer

Data Types

varchar/nvarchar/varbinary(1-8000)varchar/nvarchar/varbinary(1-8000) Maximum column length still 8,000 bytesMaximum column length still 8,000 bytes Rows can now exceed page size (without text)Rows can now exceed page size (without text)

Varchar/nvarchar/varbinary(max) Varchar/nvarchar/varbinary(max) Can hold greater than 8000 characters / bytes (max. 2GB)Can hold greater than 8000 characters / bytes (max. 2GB) varbinary(max) supports the filestream attributevarbinary(max) supports the filestream attribute

XML XML A full-fledged data typeA full-fledged data type

UDDTs UDDTs User-defined Data Types using CLRUser-defined Data Types using CLR

Page 24: SQL Server "Yukon" and the Developer

Snapshot Isolation

New transaction isolation levelNew transaction isolation level Increased Data Availability for read Increased Data Availability for read

applicationsapplications Allows Non-Blocking consistent reads in an Allows Non-Blocking consistent reads in an

OLTP environmentOLTP environment Writers don’t block readersWriters don’t block readers Readers don’t block writersReaders don’t block writers

Permits writes, which can cause conflictsPermits writes, which can cause conflicts But… includes mandatory conflict detectionBut… includes mandatory conflict detection

Great for Relational reporting ScenariosGreat for Relational reporting Scenarios

Page 25: SQL Server "Yukon" and the Developer

Server Events

Events fire on DML, DDLEvents fire on DML, DDL User can register to be notified when User can register to be notified when

certain event occurscertain event occurs User can register through WMI to be User can register through WMI to be

notified of certain DDL, DML, or trace notified of certain DDL, DML, or trace eventsevents

Page 26: SQL Server "Yukon" and the Developer

Virtual Tables

System catalog has changedSystem catalog has changed ‘‘Tables’ that reflect the internal stateTables’ that reflect the internal state 25+ virtual tables to help DBA’s25+ virtual tables to help DBA’s

Monitor the serverMonitor the server Diagnose problemsDiagnose problems

For example syswaitsFor example syswaits Check this first when server is making slow progressCheck this first when server is making slow progress Union of Union of

Deadlock monitor wait-for graphDeadlock monitor wait-for graph Waiting information as in sysprocessesWaiting information as in sysprocesses

syswaits columnssyswaits columns waitingTask, spid, waitTime, waitType, resource, waitingTask, spid, waitTime, waitType, resource,

blockingTaskblockingTask

Page 27: SQL Server "Yukon" and the Developer

SOAP Connectivity

HTTP AccessHTTP Access In addition to TCP/IP, Named Pipes, and In addition to TCP/IP, Named Pipes, and

Shared MemoryShared Memory SQL Server itself listens to HTTP SQL Server itself listens to HTTP

requestsrequests Can coexist with IIS, but IIS isn’t requiredCan coexist with IIS, but IIS isn’t required

Disabled by defaultDisabled by default Can configure which users, which stored Can configure which users, which stored

procedures, and which databases can have procedures, and which databases can have HTTP accessHTTP access

Can configure whether ad hoc batches or Can configure whether ad hoc batches or queries can be submittedqueries can be submitted

Page 28: SQL Server "Yukon" and the Developer

Bulk Data Loading

XML-based format fileXML-based format file Provides full functionality of old format file and Provides full functionality of old format file and

moremore Easy to specify and understandEasy to specify and understand Supported by T-SQL commands and BCPSupported by T-SQL commands and BCP Old format files can still be usedOld format files can still be used Old data can be loaded using XML format filesOld data can be loaded using XML format files

Mitigate security concernsMitigate security concerns Use Windows user privileges to read / write files Use Windows user privileges to read / write files

used in bulk data loadingused in bulk data loading

Improved performance and scalingImproved performance and scaling

Page 29: SQL Server "Yukon" and the Developer

Bulk Data Loading

Bad-row loggingBad-row logging Bulk data loading succeeds despite invalid rowsBulk data loading succeeds despite invalid rows Incorrectly formatted rows are redirected to Incorrectly formatted rows are redirected to

error file for analysis along with errorerror file for analysis along with error Rows violating constraints redirected to error Rows violating constraints redirected to error

table along with errorstable along with errors Uniform Insert commandUniform Insert command

T-SQL Insert-Select enhanced to support bulk T-SQL Insert-Select enhanced to support bulk data loading optimizationsdata loading optimizations Example: LoggingExample: Logging

OPENROWSET enhanced to read from a data OPENROWSET enhanced to read from a data filefile

Page 30: SQL Server "Yukon" and the Developer

Data Access API’s

Data can be programmed using relational, Data can be programmed using relational, object, or XML API’sobject, or XML API’s DataSet, ObjectSpaces, XmlReaderDataSet, ObjectSpaces, XmlReader

Same API’s available in-proc and on mid Same API’s available in-proc and on mid tiertier In all three domainsIn all three domains

Can seamlessly view and query all database Can seamlessly view and query all database data as XML data as XML Relational types and XML typeRelational types and XML type

Database logic can be invoked as a Web Database logic can be invoked as a Web serviceservice

Page 31: SQL Server "Yukon" and the Developer

Data Access API’s

ADO.NET v2.0 Enhancements:ADO.NET v2.0 Enhancements: Multiple active result sets (MARS)Multiple active result sets (MARS) Object Persistence FX (ObjectSpaces)Object Persistence FX (ObjectSpaces) Query notifications – for cache invalidationQuery notifications – for cache invalidation Parity with ADO (ADOX, etc)Parity with ADO (ADOX, etc) Server cursors (SqlResultSet)Server cursors (SqlResultSet) Asynchronous client accessAsynchronous client access Bulk update, paging, and batchingBulk update, paging, and batching User Defined Type (UDT) supportUser Defined Type (UDT) support

Page 32: SQL Server "Yukon" and the Developer

Management API’s

Windows Management Instrumentation (WMI)Windows Management Instrumentation (WMI) EventingEventing

SQL Server EngineSQL Server Engine DTS, Analysis Services, and Reporting Services (post beta DTS, Analysis Services, and Reporting Services (post beta

1)1) Configuration APIConfiguration API

Non-connected configurationNon-connected configuration

Management ObjectsManagement Objects SQL Server (SMO), Replication (RMO), Analysis Services SQL Server (SMO), Replication (RMO), Analysis Services

(AMO)(AMO) 100% managed code (written in C#)100% managed code (written in C#) Performance, scalabilityPerformance, scalability Scripting improvementsScripting improvements According to .NET library design guidelinesAccording to .NET library design guidelines

Page 33: SQL Server "Yukon" and the Developer

Developer Tools Integration

Visual Studio supports a new Yukon Visual Studio supports a new Yukon Project system Project system Easy to develop, debug and deploy .NET code Easy to develop, debug and deploy .NET code

for the database for the database

Integrated debugging experience across Integrated debugging experience across mid-tier and database tiermid-tier and database tier Seamlessly step cross-language T-SQL & .NETSeamlessly step cross-language T-SQL & .NET Set breakpoints anywhere, inspect anythingSet breakpoints anywhere, inspect anything

Visual Studio project extensions for Visual Studio project extensions for Business Intelligence projectsBusiness Intelligence projects

Page 34: SQL Server "Yukon" and the Developer

Programmability Conclusion

ChoiceChoice Where to processes dataWhere to processes data How to store data (relational, XML, UDT’s)How to store data (relational, XML, UDT’s)

ExtensibilityExtensibility User defined data types, functions, User defined data types, functions,

procedures,..procedures,..

IntegrationIntegration XMLXML SOAPSOAP Development ToolsDevelopment Tools

Page 35: SQL Server "Yukon" and the Developer

Questions?

[email protected]@microsoft.com

Page 36: SQL Server "Yukon" and the Developer

Thank you for attending. Visit www.mshug.org.