anywhere in the script file if the last line below is used it causes an error. CREATE SEQUENCE [dbo].[ReportComparisonSeq] AS INT START WI
sequences in sql 2012 is not supported by the formatter
anywhere in the script file if the last line below is used it causes an error.
CREATE SEQUENCE [dbo].[ReportComparisonSeq] AS INT START WITH 1 INCREMENT BY 1 NO CYCLE CACHE 10
DECLARE @Seq INT
SELECT @Seq = NEXT VALUE FOR [dbo].[ReportComparisonSeq]
This is included in SQL Prompt 6.4, which you can download from http://www.red-gate.com/products/sql-development/sql-prompt/
Except when using a select into a table-variable - 'cos SEQUENCE ain't available. Long live IDENTITY. (Yes, one could use ROW_NUMBER(), but as IDENTITY works very well and is easy to spot in the TV definition, I find it more convenient.) As one who endured six years of Oracle's SEQUENCE, IDENTITY is far easier to work with, is immediately visible in the table's DDL, and hasn't caused me a single moment of grief in over 8 years.
That said, support fo this suggestion unequivocally given.
Alex Fekken commented
First of all I think this item would benefit from a better, more concise title, e.g. 'Support for SEQUENCES'.
It get's my full support anyway because in my opinion IDENTITY fields are fundamentally wrong (as illustrated by the totally unnecessary mess caused by SCOPE_IDENTITY() and @@IDENTITY: e.g. http://support.microsoft.com/kb/2019779) and in most cases the use of IDENTITY is only justified by laziness and lacking convenient support for good alternatives (such as SEQUENCES).