Saturday, 15 February 2014

Sequence : Auto Generated ID's in SQL Server 2012

Hi friends , after long time come back with new excellent features of SQL Server 2012.
Don't worry , I am not posting all features because I have started reading it one by one.So need your support for more understandings.I know ,after this post my team members will help to understand and help to implement it.

UI : More rich experience like WPF of Visual Studio and good performance than R2

Sequences : Auto generated ID's

Sequences, unlike identity columns, are not associated with specific tables. Applications refer to a sequence object to retrieve its next value. The relationship between sequences and tables is controlled by the application. User applications can reference a sequence object and coordinate the values across multiple rows and tables.

Use sequences instead of identity columns in the following 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.
  • 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.
,It seems to be similar with ranking , but scope of retrieving will be more than ranking.

This post will be continued , after trying. Till time start reading and share it.