18
New features of SQL 2012 Sathyan R [email protected] ALL SAMPLES FROM ADVENTUREWORKS2012 DB

New features of SQL 2012

Embed Size (px)

DESCRIPTION

One of the most important factors to be successful as a developer is being up to date in knowledge and unlearning old outdated stuff and learning new stuff. This is very essential whenever there is a new release of a product that we are working in. Here is an attempt to learn together the new features of SQL 2012.

Citation preview

Page 1: New features of SQL 2012

New features of SQL 2012

Sathyan [email protected]

ALL SAMPLES FROM ADVENTUREWORKS2012 DB

Page 2: New features of SQL 2012

Agenda

- Shortcuts - New DMVs - Spatial Indexes - Columstore Indexes - String Functions - DateTime Functions - Conversion Functions - Offset and Fetch - Sequence - With Result Sets - Error Handling Enhancements - Filetable - Analytical Functions - Questions posed by Big Data

Page 3: New features of SQL 2012

Shortcuts

Keyboard ShortcutsQuery ShortcutsFormatting ShortcutsAuto Recover (Old)Visual Studio CompatibleFull List

Page 4: New features of SQL 2012

New DMVs

Server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance.

Multiple Types (DB, Extended Events, Execution, Mirroring, CLR, Index, I/O, Security, Etc.)

New Additions in 2012Select *

Page 5: New features of SQL 2012

Spatial Indexes

Faster build time for spatial indexes on point data – critical for tables with millions of rows

Optimized STDistance and STBuffer FunctionsRow Compression and Page Compressionsp_help_spatial_geography_histogram

sp_help_spatial_geometry_histogramMore Details

Page 6: New features of SQL 2012

Columnstore Indexes

Star Schema - Fact table – Dimension TableRow Based StorageColumnstore Indexes – Performance

ImprovementSyntaxRestrictions – Insert/UpdateData type restrictionsClustered Columnstore Index?

Page 7: New features of SQL 2012

String Functions

CONCAT◦Auto Handles NULL

FORMAT◦Addresses Issues in DateTime Formatting ◦Culture specific same as in .NET ◦FORMAT ( value, format [, culture ] )

Page 8: New features of SQL 2012

DATETIME Functions

EOMONTHDATEFROMPARTS

◦Sample, Format DateDATETIME2FROMPARTSTIMEFROMPARTSDATETIMEFROMPARTSDATETIMEOFFSETFROMPARTS

Page 9: New features of SQL 2012

Conversion Functions

TRY_PARSEPARSETRY_CONVERT

Page 10: New features of SQL 2012

Logical Functions

IIFCHOOSE

Page 11: New features of SQL 2012

Offset and Fetch

Are You Paginating Right?

Page 12: New features of SQL 2012

SEQUENCE

IdentitySEQUENCE - at DB level - used across

multiple tables – Controlled by AppSEQUENCE can be reset without altering

its previous value – MIN – MAX - CYCLE

Page 13: New features of SQL 2012

SEQUENCE USAGE - MSDN

The application requires a number before the insert into the table is made. The application requires sharing a single series of numbers between multiple

tables or multiple columns within a table. The application must restart the number series when a specified number is

reached. For example, after assigning values 1 through 10, the application starts assigning values 1 through 10 again.

The application requires sequence values to be sorted by another field. The NEXT VALUE FOR function can apply the OVER clause to the function call. The OVER clause guarantees that the values returned are generated in the order of the OVER clause's ORDER BY clause.

An application requires multiple numbers to be assigned at the same time. For example, an application needs to reserve five sequential numbers. Requesting identity values could result in gaps in the series if other processes were simultaneously issued numbers. Calling sp_sequence_get_range can retrieve several numbers in the sequence at once.

You need to change the specification of the sequence, such as the increment value.

Page 14: New features of SQL 2012

WITH RESULT SETS

change the column names and data typesof the result set returned in the execution of a SP

Page 15: New features of SQL 2012

Error Handling With Throw

Much Easier, SimplerSimilar to .NETNo need of @@RAISE_ERROR Anymore

Page 17: New features of SQL 2012

Analytical Functions

FIRST_VALUELAST_VALUELAGLEAD

Page 18: New features of SQL 2012

Questions Posed by BigData

Velocity Volume Variability Hadoop - DFSFacebook Twitter GoogleTwo different reasonsSSD – Solid State Data Storage allows

100,000s IOPS Vs 150 to 200Hortonworks and Cloudera