|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 5:22 AM
Points: 1,037,
Visits: 1,354
|
|
| Comments posted to this topic are about the item Sequences I
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 2:24 AM
Points: 1,871,
Visits: 2,692
|
|
got it wrong, as the correct answer wasn't listed. your syntax is wrong in, sequence wouldn't be created to start of with...no increment value, no 'AS'..etc.
---------------------------------------------- Msg 8134, Level 16, State 1, Line 1 Divide by zero error encountered.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 1:01 PM
Points: 9,367,
Visits: 6,463
|
|
Henrico Bekker (4/16/2012) got it wrong, as the correct answer wasn't listed. your syntax is wrong in, sequence wouldn't be created to start of with...no increment value, no 'AS'..etc.
When I look at BOL I see the following:
CREATE SEQUENCE [schema_name . ] sequence_name [ AS [ built_in_integer_type | user-defined_integer_type ] ] [ START WITH <constant> ] [ INCREMENT BY <constant> ] [ { MINVALUE [ <constant> ] } | { NO MINVALUE } ] [ { MAXVALUE [ <constant> ] } | { NO MAXVALUE } ] [ CYCLE | { NO CYCLE } ] [ { CACHE [ <constant> ] } | { NO CACHE } ] [ ; ]
This means that everything is optional except the first line. MSDN also lists every default value for every line.
edit: Example E in the MSDN article is exactly the same as the QotD.
Anyway, awesome question. Really like the SQL Server 2012 questions!
How to post forum questions. Need an answer? No, you need a question. What’s the deal with Excel & SSIS?
Member of LinkedIn. My blog at LessThanDot.
 MCSA SQL Server 2012 - MCSE Business Intelligence
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, May 17, 2013 1:49 AM
Points: 3,123,
Visits: 4,310
|
|
Interesting question, thanks...
____________________________________________ Space, the final frontier? not any more... All limits henceforth are self-imposed. “libera tute vulgaris ex”
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:04 AM
Points: 1,968,
Visits: 1,819
|
|
I am curious to know how many developpers will use default value for "START WITH". In most cases will be a negative number.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 1:01 PM
Points: 9,367,
Visits: 6,463
|
|
Carlo Romagnano (4/17/2012) I am curious to know how many developpers will use default value for "START WITH". In most cases will be a negative number.
They will all be negative, except for tinyint. In most cases this shouldn't be a problem, unless you are using the sequence for generating surrogate keys and you have tied special meaning to some of them.
For example: 0 equals unknown, -1 equals not applicable.
How to post forum questions. Need an answer? No, you need a question. What’s the deal with Excel & SSIS?
Member of LinkedIn. My blog at LessThanDot.
 MCSA SQL Server 2012 - MCSE Business Intelligence
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:04 AM
Points: 1,968,
Visits: 1,819
|
|
Koen Verbeeck (4/17/2012)
Carlo Romagnano (4/17/2012) I am curious to know how many developpers will use default value for "START WITH". In most cases will be a negative number.
They will all be negative, except for tinyint. In most cases this shouldn't be a problem, unless you are using the sequence for generating surrogate keys and you have tied special meaning to some of them. For example: 0 equals unknown, -1 equals not applicable.
A number is a number, it doesn't matter if it is negative or positive, but when you do maintanance on table or you should copy and paste values to/from excel, great numbers are annoying.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Saturday, March 16, 2013 9:53 AM
Points: 847,
Visits: 768
|
|
Thanks for the question
Iulian
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 1:59 AM
Points: 1,126,
Visits: 924
|
|
| Thanks for the question. I had to do a fair bit of digging to find out the answer.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 1:19 AM
Points: 2,473,
Visits: 2,131
|
|
Good question today, thanks - took an educated guess and got it wrong.
Looks like I need more education.
------------------------------- Posting Data Etiquette - Jeff Moden Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan I would never join a club that would allow me as a member - Groucho Marx
|
|
|
|