![]() Created a SEQUENCE object in Microsoft SQL Server Management Studio ![]() ![]() The new SEQUENCE object can also be seen in the Microsoft SQL Server Management Studio (Figure 1).įigure 1. The code for creating one SEQUENCE object is given in Example 1. Just that the same SEQUENCE object can be used on two tables as the primary key was enough for me. Let me remind you that IDENTITY is most commonly used as the primary key in spreadsheets. The problem was that such a primary key could not be used in PARTIALIZED VIEWs that could be greatly improved by performance.ĬREATE SEQUENCE sequence_name Then the SEQUENCE object can define the rank etc… What are the traits?įirst, SEQUENCE is a separate object and is not bound to a specific table and one SEQUENCE object can be used on multiple tables in parallel. Second, SEQUENCE can be altered. In this post, I will explain how Sequence works in SQL Server that has started to be used since the 2012 version. In the Oracle database, sequences have been used for a long time, but in MSSQL Server they have just started to be used with version 2012. The SEQUENCE object is most commonly used to obtain the value for a surrogate key in tables, most commonly used in the same way as IDENTITY is used. To clarify immediately, SEQUENCE is not the same as IDENTITY and is not a replacement for IDENTITY. IDENTITY is the property of a specific column on a concrete table and SEQUENCE is an object. SEQUENCE was added because of some non-IDENTITY features that were still needed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |