Developers' New features of Sql server express 2012

Post on 05-Jul-2015

860 views 1 download

transcript

Presented By

Md. Ziaur Rahman

Senior Software EngineerAstha IT Research and Consultancy Ltd.

Targeted Product : SQL Server 2012 Express

Hardware and Software Requirement

Limitations

Installation

New Features

How to publish Data By MSSQL 2012 Express

32-bit systems Computer with Intel or compatible 1GHz or faster

processor (2 GHz or faster is recommended.)

64-bit systems 1.4 GHz or faster processor

Minimum of 512 MB of RAM (2 GB or more is recommended.)

2.2 GB of available hard disk space

OS : Windows 7, Windows Server 2008 R2, Windows Server 2008 Service Pack 2, Windows Vista Service Pack 2

Installations can only make use of one CPU with a four core maximum

Installations can only make use of 1GB of RAM, regardless of the amount of memory installed

Databases built with Express Edition are limited to 10GB in size

Express Edition does not offer the database mirroring, log shipping, or merge publication features offered in the larger product

SQL Server Express Edition does not include Oracle replication functionality

The tools available with Express Edition are limited – the installer does not include Database Tuning Advisor, SQL Agent, or SQL

Profiler

SQL Server 2012 introduces 14 new built-in functions. The new functions are: Conversion functions PARSE (Transact-SQL) TRY_CONVERT (Transact-SQL) TRY_PARSE (Transact-SQL) Date and time functions DATEFROMPARTS (Transact-SQL) DATETIME2FROMPARTS (Transact-SQL) DATETIMEFROMPARTS (Transact-SQL) DATETIMEOFFSETFROMPARTS (Transact-SQL) EOMONTH (Transact-SQL) SMALLDATETIMEFROMPARTS (Transact-SQL) TIMEFROMPARTS (Transact-SQL) Logical functions CHOOSE (Transact-SQL) IIF (Transact-SQL) String functions CONCAT (Transact-SQL) FORMAT (Transact-SQL)

Syntax : CHOOSE ( index, val_1, val_2 [, val_n ] )Example :SELECT CHOOSE ( 3, 'Manager', 'Director', 'Developer',

'Tester' ) AS Result;

Result -------------Developer (1 row(s) affected)

Execute a stored procedure or function [ { EXEC | EXECUTE } ] { [ @return_status = ] { module_name [ ;number ] | @module_name_var } [ [ @parameter = ] { value | @variable [ OUTPUT ] | [ DEFAULT ] } ] [ ,...n ] [ WITH <execute_option> [ ,...n ] ] } [;]

Execute a character string { EXEC | EXECUTE } ( { @string_variable | [ N ]'tsql_string' } [ + ...n ] ) [ AS { LOGIN | USER } = ' name ' ] [;]

Execute a pass-through command against a linked server { EXEC | EXECUTE } ( { @string_variable | [ N ] 'command_string [ ? ]' } [ + ...n ] [ { , { value | @variable [ OUTPUT ] } } [ ...n ] ] ) [ AS { LOGIN | USER } = ' name ' ] [ AT linked_server_name ] [;]

<execute_option>::= { RECOMPILE | { RESULT SETS UNDEFINED } | { RESULT SETS NONE } | { RESULT SETS ( <result_sets_definition> [,...n ] ) } }

<result_sets_definition> ::= { ( { column_name data_type [ COLLATE collation_name ] [ NULL | NOT NULL ] } [,...n ] ) | AS OBJECT [ db_name . [ schema_name ] . | schema_name . ] {table_name | view_name | table_valued_function_name } | AS TYPE [ schema_name.]table_type_name | AS FOR XML }

-- Execute the procedure

EXEC Production.ProductList '%tire%‘

WITH RESULT SETS (

(ProductID int, -- first result set

Name nvarchar(255),

ListPrice money) , -- comma & 2nd RS

(Name nvarchar(255) ,

NumberOfOrders int

));

Old Code :

DECLARE @Offset AS INT = 6 DECLARE @PageSize AS INT = 5 SELECT Id, Name FROM ( SELECT Id, Name, ROW_NUMBER() OVER (ORDER BY Id) AS

RowNumberFROM Users ) UsersSelectionWHERE UsersSelection.RowNumber > @Offset AND

UsersSelection.RowNumber <= @Offset + @PageSize

SQL server 2012 Code :

DECLARE @Offset AS INT = 6

DECLARE @PageSize AS INT = 5

SELECT Id,

Name

FROM Users

ORDER BY Id

OFFSET @Offset ROWS

FETCH NEXT @PageSize ROWS ONLY

Purpose :Better performance for auto-generated IDs and easier to have

IDs unique across tables.

Scenarios :

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.

INSERT INTO Monitors

(

Id,

Width

)

VALUES

(

NEXT VALUE FOR seqInventory,

19

)

Data publishing is same like SQL Server 2008.

Steps are :