Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I upgraded my SQL Server 2008 R2 to SQL Server 2012, and I had noticed a new feature was added: Sequence.

I don't know the reason of adding sequences when there is an identity property.

Can someone elaborate on what this feature is useful for?

share|improve this question

closed as not a real question by Marian, gbn, Paul White, Mark Storey-Smith, RolandoMySQLDBA Jun 11 '13 at 12:04

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

@a_horse_with_no_name Just because this information is elsewhere on the web doesn't mean an answer consolidating the info on this site wouldn't be useful though. – Martin Smith Jun 11 '13 at 9:07
@MartinSmith: true, however I think we could except some basic searching to be done before asking such a question. After all the tooltip for the downvote arrow starts with "The question does not show any research effort" which is clearly the case here. – a_horse_with_no_name Jun 11 '13 at 9:09
up vote 6 down vote accepted

Some examples

A sequence:

  • allows you know the new number before you actually write to the table
    Example: how to get the IDENTITY value in a BEFORE TRIGGER
  • one sequence can be used for more then one table
    A.k.a get a value that will be unique across many tables without supertype/subtype
share|improve this answer

Can someone elaborate on what this feature is useful for?

Generating sequences, is that not obvious?

Stuff like account numbers, order numbers, order numbers - that may not even be used as identity as in identity column.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.