Monday, January 30, 2012

SQL Server 2012 (Denali) New Features for Developers (Programming Enhancements)

Programmability enhancements in the Database Engine include FileTables, statistical semantic search, property-scoped full-text search and customizable proximity search, ad-hoc query paging, circular arc segment support for spatial types, support for sequence objects, default support for 15,000 partitions, and numerous improvements and additions to Transact-SQL.

Native XML Web Services (SOAP/HTTP endpoints) is Removed:
Beginning in Microsoft SQL Server 2012 Release Candidate 0 (RC 0), you can no longer use CREATE ENDPOINT or ALTER ENDPOINT to add or modify SOAP/HTTP endpoints.

FileTables:
The FileTable feature builds on top of the SQL Server FILESTREAM technology to bring support for the Windows file namespace and compatibility with Windows applications to the file data stored in SQL Server. This lets an application integrate its storage and data management components, and provides integrated SQL Server services (including full-text search and semantic search) over unstructured data and metadata, along with easy policy management and administration.

In summary, you can now store files and documents in special tables in SQL Server, but access them from Windows applications as if they were stored in the file system, without making any changes to the Windows applications.


Metadata Discovery:
The SET FMTONLY option for determining the format of a response without actually running the query is replaced with
sp_describe_first_result_set,
sp_describe_undeclared_parameters,
sys.dm_exec_describe_first_result_set, and
sys.dm_exec_describe_first_result_set_for_object.

EXECUTE Statement
The EXECUTE statement can now specify the metadata returned from the statement by using the WITH RESULT SETS argument.

A new family of supplementary characters (SC) collations can be used with the data types nchar, nvarchar and sql_variant.
For example: Latin1_General_100_CI_AS_SC or, if using a Japanese collation, Japanese_Bushu_Kakusu_100_CI_AS_SC.
These collations encode Unicode characters in the UTF-16 format. Characters with codepoint values larger than 0xFFFF require two consecutive 16-bit words. These characters are called supplementary characters, and the two consecutive 16-bit words are called surrogate pairs. SC collations can improve searching and sorting by functions that use the Unicode types nchar and nvarchar. For more information, see Collation and Unicode Support.
UTF-16 Supplementary Characters (SC) Collation Option for XML


Ad-hoc Query Paging Implementation
You can specify a range of rows returned by a SELECT statement based on row offset and row count values that you provide. This is useful when you want to control the number of rows sent to a client application for a given query.
 
SELECT ID, Name
FROM Person
ORDER BY ID
OFFSET 10 ROWS
FETCH NEXT 10 ROWS ONLY;

New Spatial Features
Circular Arc Segment Support for Spatial Types

Three new sub-data types for geometry and geography data types can be used to store circular arc segments, CircularString, CompoundCurve, and CurvePolygon. Methods for geography and geometry data types support the new circular arc segment data types. There are new methods for geometry and geography data types that work with circular arc segments, OGC Methods on Geography Instances, OGC Methods on Geometry Instances, Extended Methods on Geography Instances, Extended Methods on Geometry Instances and SQL MM Methods on Geography Instances. There are new static aggregate methods for geometry data type and geography data type, Extended Static Geography Methods and Extended Static Geometry Methods.

Sequence ObjectsA sequence object is a user-defined schema-bound object that generates a sequence of numeric values according to the specification with which the sequence was created. It operates similar to an identity column, but sequence numbers are not restricted to use in a single table.

THROW statementThe THROW statement can be used to raise an exception and transfer execution to a CATCH block of a TRY…CATCH construct.

14 New Functions and 1 Changed Function:

Microsoft SQL Server 2012 Release Candidate 0 (RC 0) introduces 14 new built-in functions. These functions ease the path of migration for information workers by emulating functionality that is found in the expression languages of many desktop applications. However these functions will also be useful to experienced users of SQL Server.

The new functions are:
Conversion functions    PARSE
    TRY_CONVERT
    TRY_PARSE
Date and time functions    DATEFROMPARTS
    DATETIME2FROMPARTS
    DATETIMEFROMPARTS
    DATETIMEOFFSETFROMPARTS
    EOMONTH
    SMALLDATETIMEFROMPARTS
    TIMEFROMPARTS
Logical functions
    CHOOSE
    IIF
String functions
    CONCAT
    FORMAT

In addition to the 14 new functions, one existing function has been changed. The existing LOG function now has an optional second base parameter.

SQL Server Express LocalDBSQL Server Express LocalDB is a new lightweight edition of Express that has all its programmability features, yet runs in user mode and has a fast, zero-configuration installation and short list of pre-requisites. The LocalDB edition of SQL Server is targeted to program developers. LocalDB installation copies a minimal set of files necessary to start the SQL Server Database Engine. To use the SQL Server Database Engine, developers connect directly to the database files and the SQL Server infrastructure is transparent to them. Developer Tools can provide developers with a SQL Server Database Engine that lets them write and test Transact-SQL code without having to manage a full server instance of SQL Server. An instance of SQL Server Express LocalDB is managed by using the SqlLocalDB.exe utility. SQL Server Express LocalDB should be used in place of the SQL Server Express user instance feature which is deprecated.

New and Enhanced Query Optimizer HintsThe syntax for the FORCESEEK table hint has been modified.
You can now specify an index and index columns to further control the access method on the index. The existing FORCESEEK syntax remains unmodified and works as before. No changes to applications are necessary if you do not plan to use the new functionality.

The FORCESCAN table hint has been added. It complements the FORCESEEK hint by specifying that the query optimizer use only an index scan operation as the access path to the table or view referenced in the query. The FORCESCAN hint can be useful for queries in which the optimizer underestimates the number of affected rows and chooses a seek operation rather than a scan operation. FORCESCAN can be specified with or without an INDEX hint.

Extended Event EnhancementsThe following new Extended Events are available.
page_allocated:
    Fields: worker_address, number_pages, page_size, page_location, allocator_type, page_allocator_type, pool_id
page_freed:
    Fields: worker_address, number_pages, page_size, page_location, allocator_type, page_allocator_type, pool_id
allocation_failure:
    Fields: worker_address, failure_type, allocation_failure_type, resource_size, pool_id, factor

The following Extended Events have been modified.
resource_monitor_ring_buffer_record:
    Fields removed: single_pages_kb, multiple_pages_kb
    Fields added: target_kb, pages_kb

memory_node_oom_ring_buffer_recorded:
    Fields removed: single_pages_kb, multiple_pages_kb
    Fields added: target_kb, pages_kb

   
OVER Clause Support Enhanced
The OVER clause has been extended to support window functions. Window functions perform a calculation across a set of rows that are in some relationship to the current row. For example, you can use the ROWS or RANGE clause over a set of rows to calculate a moving average or cumulative total.
In addition, ordering rows within a partition is now supported in the aggregate functions that allow the OVER clause to be specified.

Analytic Functions
The following analytic functions have been added.
CUME_DIST
LAST_VALUE
PERCENTILE_DISC
FIRST_VALUE
LEAD
PERCENT_RANK
LAG
PERCENTILE_CONT

1 comment: