SQL Server 2008OverviewOverview
Presented by Tarek GhazaliIT Technical SpecialistIT Technical SpecialistMicrosoft SQL Server MVP, MCTSMicrosoft Web Development MCPMicrosoft Web Development MCPITIL V3 Foundation Certified
© 2009 Tarek Ghazali. All rights reserved.
What is new in SQL What is new in SQL Server 2008Server 2008 More powerful management More powerful management
– Policy Management featurePolicy Management feature Improved performance and scalabilityImproved performance and scalability
– Storing high volume of dataStoring high volume of data– Support for diverse types of data Support for diverse types of data
Better security and availability Better security and availability – Security increased by data encryptionSecurity increased by data encryption– Availability increased by database mirroringAvailability increased by database mirroring
Changes for developers Changes for developers
LINQ (Language LINQ (Language Integrated Query)Integrated Query) LINQ enables database LINQ enables database
developers to issue queries developers to issue queries against a database using a .NET-against a database using a .NET-based programming language based programming language instead of the normal T-SQL instead of the normal T-SQL statements.statements.
LINQ (Language LINQ (Language Integrated Query) Integrated Query) (Cont.)(Cont.) SQL Server 2008 enhances LINQ by SQL Server 2008 enhances LINQ by
providing a new LINQ to SQL providing a new LINQ to SQL provider that allows developers to provider that allows developers to issue LINQ commands directly issue LINQ commands directly against SQL Server tables and against SQL Server tables and columnscolumns
This will reduce the amount of time This will reduce the amount of time it takes to create new data queriesit takes to create new data queries
Enhancement of T-SQL Enhancement of T-SQL StatementsStatements MERGEMERGE statement: It allows the statement: It allows the
developer to check for the existence developer to check for the existence of data before trying to insert the of data before trying to insert the data. data.
Allows you to merge two tables Allows you to merge two tables together based on a set of criteriatogether based on a set of criteria
Useful for synchronizing dataUseful for synchronizing data Great for consolidating in a Data Great for consolidating in a Data
WarehouseWarehouse
Enhancement of T-SQL Enhancement of T-SQL Statements (Cont.)Statements (Cont.) No longer it is necessary to create No longer it is necessary to create
complex joins in order to update complex joins in order to update data that exists and to insert data data that exists and to insert data that does not already exist, all that does not already exist, all during a single statement.during a single statement.
Table Valued Table Valued Parameters (TVP)Parameters (TVP) TVPTVP's make possible to use a "table" as a 's make possible to use a "table" as a
parameter for a procedureparameter for a procedure Limitations:Limitations:
1.1. TVP's can only be READONLY in the procedure TVP's can only be READONLY in the procedure that define them as a parameterthat define them as a parameter
2.2. Can only be used as an input parameter.Can only be used as an input parameter.
3.3. Apart from this the same rules apply to TVP's as Apart from this the same rules apply to TVP's as to table variables for example no DDL can be to table variables for example no DDL can be executed against a TVP and no statistics are kept executed against a TVP and no statistics are kept for TVP's.for TVP's.
Data Compression Data Compression
Works on tables and indexesWorks on tables and indexes Works on clustered and non-Works on clustered and non-
clustered indexesclustered indexes Compression types: Page and Compression types: Page and
RowRow T-SQL extensions to Table and T-SQL extensions to Table and
Index DDLIndex DDL
Data Compression Data Compression (Cont.)(Cont.) CREATE TABLE... [WITH (<table_option> CREATE TABLE... [WITH (<table_option>
[,...n])]<table_option>:={ DATA_COMPR[,...n])]<table_option>:={ DATA_COMPRESSION = {NONE|ROW|PAGE}[ON ESSION = {NONE|ROW|PAGE}[ON PARTITIONS PARTITIONS ({<partition_number_expression>|({<partition_number_expression>|<range>} [,...n])]<range>} [,...n])]
New SP to estimate cost savingsNew SP to estimate cost savings sp_estimate_data_compression_savingssp_estimate_data_compression_savings
New DatatypesNew DatatypesDate and Time Date and Time DatatypesDatatypes DATE – a date only type (precision DATE – a date only type (precision
1 day)1 day) TIME – a time only type (precision TIME – a time only type (precision
100 nano seconds)100 nano seconds) DATETIMEOFFSET –a time zone DATETIMEOFFSET –a time zone
aware datetime type (precision aware datetime type (precision 100 nano seconds)100 nano seconds)
Date and Time Date and Time Datatypes (Cont.)Datatypes (Cont.) DATETIME2 – a datetime type DATETIME2 – a datetime type
with larger fractional seconds and with larger fractional seconds and year range than the existing year range than the existing DATETIME type (precision 100 DATETIME type (precision 100 nano seconds)nano seconds)
HierarchyId: New HierarchyId: New datatypedatatype Enables database applications to Enables database applications to
model tree structures in a more model tree structures in a more efficient way than currently possible efficient way than currently possible
Stores values that represent nodes in a Stores values that represent nodes in a hierarchy treehierarchy tree
Implemented as a CLR UDT that Implemented as a CLR UDT that exposes several efficient and useful exposes several efficient and useful built-in methods for creating and built-in methods for creating and operating on hierarchy nodesoperating on hierarchy nodes
Spatial DatatypesSpatial Datatypes
Geography datatypeGeography datatype Round Earth geospatial modelRound Earth geospatial model Define points, lines, and areas Define points, lines, and areas
with longitude and latitudewith longitude and latitude Account for planetary curvature Account for planetary curvature
and obtain accurate “great circle” and obtain accurate “great circle” distancesdistances
Spatial Datatypes Spatial Datatypes (Cont.)(Cont.) Geometry datatypeGeometry datatype
– Planar (“Flat Earth”) geospatial modelPlanar (“Flat Earth”) geospatial model– Define points, lines, and areas with coordinatesDefine points, lines, and areas with coordinates– Use for localized areas or non-projected Use for localized areas or non-projected
surfacessurfaces
Both types provide static and Both types provide static and instance methodsinstance methods– Calculate distances, find intersections, etc.Calculate distances, find intersections, etc.
FILESTREAM datatypeFILESTREAM datatype
Stores data in the File System but, Stores data in the File System but, allows it to be queried via normal T-allows it to be queried via normal T-SQLSQL
Allows easy transition between Allows easy transition between relational and non-relational data, so relational and non-relational data, so application can access documents as application can access documents as datadata
Under the covers uses the Win32 APIs Under the covers uses the Win32 APIs to speed streaming of data.to speed streaming of data.
FILESTREAM datatypeFILESTREAM datatype
Stores data in the File System but, Stores data in the File System but, allows it to be queried via normal T-allows it to be queried via normal T-SQLSQL
Allows easy transition between Allows easy transition between relational and non-relational data, so relational and non-relational data, so application can access documents as application can access documents as datadata
Under the covers uses the Win32 APIs Under the covers uses the Win32 APIs to speed streaming of data.to speed streaming of data.
FILESTREAM datatype FILESTREAM datatype (Cont.)(Cont.) Allows developers Use T-SQL Allows developers Use T-SQL
SELECT/INSERT/UPDATE/DELETE SELECT/INSERT/UPDATE/DELETE statements to query or modify statements to query or modify FILESTREAM dataFILESTREAM data
Data stored outside of the Data stored outside of the database on more cost-effective database on more cost-effective storage without comprising storage without comprising features for accessing such data.features for accessing such data.
New Security FeaturesNew Security Features
SQL Server 2005 introduced data SQL Server 2005 introduced data security in the form of data security in the form of data encryptionencryption
With SQL Server 2008, encryption is With SQL Server 2008, encryption is greatly enhanced with the greatly enhanced with the introduction of two features: introduction of two features: Extensible Key Management Extensible Key Management and and Transparent Data EncryptionTransparent Data Encryption
New Security Features New Security Features (Cont.)(Cont.) Extensible Key Management Extensible Key Management
allows for an enhanced structure allows for an enhanced structure to safely store the keys used in to safely store the keys used in the encryption infrastructure—not the encryption infrastructure—not only in the database itself but only in the database itself but also outside the database in third-also outside the database in third-party software modules or with a party software modules or with a Hardware Security ModuleHardware Security Module
New Security Features New Security Features (Cont.)(Cont.) Transparent Data Encryption Transparent Data Encryption
offers improved flexibility for offers improved flexibility for encrypting data by allowing encrypting data by allowing encryption to be a property of the encryption to be a property of the database and not just the result database and not just the result of functions in a line of codeof functions in a line of code
DemoDemo
Resources & QuestionsResources & Questions
Microsoft Resources:Microsoft Resources:– http://msdn.microsoft.com/sqlserver/– http://www.microsoft.com/sql/community
Contact me: Contact me: – [email protected]@sqlmvp.com
Download Presentation:Download Presentation:– http://www.sqlmvp.com