<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx</link><description>Many applications need to generate sequentially incremental number as unique/primary key of records. This blog describes additional options of generating sequence numbers beyond the SQL Server's support of identity column.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#10355654</link><pubDate>Wed, 03 Oct 2012 20:02:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10355654</guid><dc:creator>Kash</dc:creator><description>&lt;p&gt;Sequence feature which has been in Oracle for a number of years is now available in MS SQL 2012. A Sequence object is an object that provides functionality similar to Identity (Autonumber) column &lt;/p&gt;
&lt;p&gt;The sequence object can be used with more than one table which is not possible in identity object. This is useful when you have parent-child tables and you want to know the value before you insert records.&lt;/p&gt;
&lt;p&gt;Kash Mughal &lt;/p&gt;
&lt;p&gt;Senior DBA and Trainer &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.sqlserver2012tutorial.com"&gt;www.sqlserver2012tutorial.com&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10355654" width="1" height="1"&gt;</description></item><item><title>re: SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#10187678</link><pubDate>Mon, 18 Jul 2011 22:20:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10187678</guid><dc:creator>Ayyappan Thangaraj</dc:creator><description>&lt;p&gt;Now, It is in SQL Server Denali...:)&lt;/p&gt;
&lt;p&gt;Sequence Object&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10187678" width="1" height="1"&gt;</description></item><item><title>re: SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#1260376</link><pubDate>Mon, 11 Dec 2006 21:01:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1260376</guid><dc:creator>tdwils</dc:creator><description>&lt;p&gt;You can avoid accumulating data in the sequence table by putting the INSERT statement inside a nested transaction with a save point that you then rollback.&lt;/p&gt;
&lt;p&gt;begin tran&lt;/p&gt;
&lt;p&gt;save tran seq&lt;/p&gt;
&lt;p&gt;insert into &amp;lt;tablename&amp;gt; default values&lt;/p&gt;
&lt;p&gt;set @NewSeqValue = scope_identity()&lt;/p&gt;
&lt;p&gt;rollback tran seq&lt;/p&gt;
&lt;p&gt;commit&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1260376" width="1" height="1"&gt;</description></item><item><title>FAQ: SQL Server and Sequence Objects/Generators</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#1241826</link><pubDate>Fri, 08 Dec 2006 23:07:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1241826</guid><dc:creator>Euan Garden's BLOG</dc:creator><description>&lt;p&gt;SQL Server 2005 includes a lot of changes to help make moving from Oracle to SQL Server easier, these&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1241826" width="1" height="1"&gt;</description></item><item><title>Microsoft SQL Server Development Customer Advisory Team - Simulating Sequence Objects in SQL Server</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#578379</link><pubDate>Tue, 18 Apr 2006 20:10:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:578379</guid><dc:creator>Professional Association for SQL Server (PASS) SIG</dc:creator><description>&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=578379" width="1" height="1"&gt;</description></item><item><title>re: SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#575947</link><pubDate>Thu, 13 Apr 2006 22:06:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:575947</guid><dc:creator>howardy</dc:creator><description>&lt;br&gt;The method you described certainly will work just fine. &amp;nbsp;The key of this post is to perform the generation of sequence number prior to DML &amp;nbsp;inserts through an identity column based dummy table to improve concurrency.&lt;br&gt;&lt;br&gt;There can be many variation, and enhancements in different implementations. &amp;nbsp;The sample code is just for illustrative purpose :)&lt;br&gt;&lt;br&gt;One option can be using the extra field (of course a larger size) to hold additional information of the sequence, such as min/max, and loopback flag - through a dummy record. &amp;nbsp;And the stored procedure &amp;quot;GetNewSeqVal...&amp;quot; can be enhanced to perform some checks.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=575947" width="1" height="1"&gt;</description></item><item><title>re: SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#575479</link><pubDate>Thu, 13 Apr 2006 05:45:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:575479</guid><dc:creator>Adam Machanic</dc:creator><description>I'm a bit confused about Option 2. &amp;nbsp;Why did you add the second column? &amp;nbsp;Why not just have a single column and do:&lt;br&gt;&lt;br&gt;INSERT &amp;lt;tablename&amp;gt;&lt;br&gt;DEFAULT VALUES&lt;br&gt;&lt;br&gt;?&lt;br&gt;&lt;br&gt;Does the additional column help with something in this scenario?&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=575479" width="1" height="1"&gt;</description></item><item><title>re: SQL Server Sequence Number</title><link>http://blogs.msdn.com/b/sqlcat/archive/2006/04/10/sql-server-sequence-number.aspx#573174</link><pubDate>Tue, 11 Apr 2006 10:52:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:573174</guid><dc:creator>Andy Mackie</dc:creator><description>Very useful! But ... why can't SQL Server 2005 just implement sequences natively ? That would make life so much simpler, and avoid the need for workarounds such as this. Now if you could get it into 2005 SP1, that would be great :-).&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=573174" width="1" height="1"&gt;</description></item></channel></rss>