Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

Sequences III Expand / Collapse
Author
Message
Posted Monday, April 30, 2012 8:29 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 10:52 AM
Points: 1,366, Visits: 1,729
Comments posted to this topic are about the item Sequences III
Post #1292905
Posted Monday, April 30, 2012 8:30 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, November 6, 2014 1:00 PM
Points: 5,333, Visits: 25,277
Nice question - finally beginning to understand what a "Sequence", is and how it works ..........THANKS

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1292908
Posted Monday, April 30, 2012 10:51 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Friday, October 24, 2014 12:43 PM
Points: 4,126, Visits: 3,428
Thanks for a really easy one!

(I wish I came up with it...)
Post #1292933
Posted Tuesday, May 1, 2012 1:50 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 8:03 AM
Points: 825, Visits: 319
I think this question indicates that using default values with a new item like CREATE SEQUENCE isn't a great idea. I, for one, will be defining everything (AS, START WITH, INCREMENT BY, MINVALUE, MAXVALUE, CYCLE, CACHE) if I get round to using sequences in SQLServer. I know it might look wordy and take up a few more lines but for the sake of clarity, and potential help in solving problems, I would think it worth it.
Post #1292967
Posted Tuesday, May 1, 2012 3:09 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 7,874, Visits: 9,613
Nice question. Easy if one recognises the decimal representation of 2**31.

Tom
Post #1292994
Posted Tuesday, May 1, 2012 5:37 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, November 24, 2014 10:03 AM
Points: 1,895, Visits: 2,194
Argh! Blew right past the CYCLE/NO CYCLE option explanation in BOL, looking for behavior when min value exceeded. SHould have had that first cup of green tea.

Thanks for the question! I've really enjoyed these questions on CREATE SEQUENCE. I look forward to using it when my company moves to 2012 ....

.... in 2021!




Please don't go. The drones need you. They look up to you.
Connect to me on LinkedIn
Post #1293043
Posted Tuesday, May 1, 2012 5:38 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 4:17 AM
Points: 1,156, Visits: 1,124
I like these sequence questions, despite the fact I keep getting them wrong
Post #1293044
Posted Tuesday, May 1, 2012 5:49 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 5:55 AM
Points: 1,813, Visits: 6,586
Does anyone have any suggestions for possible uses for sequences? Once upon a time I'd have used them for populating primary keys instead of using identities (ie the way I used to in Oracle). But now that we have the Output clause to easily read back the generated values there doesn't seem much advantage in using a sequence instead.
Post #1293051
Posted Tuesday, May 1, 2012 5:56 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 8:03 AM
Points: 825, Visits: 319
Toreador (5/1/2012)
Does anyone have any suggestions for possible uses for sequences? Once upon a time I'd have used them for populating primary keys instead of using identities (ie the way I used to in Oracle). But now that we have the Output clause to easily read back the generated values there doesn't seem much advantage in using a sequence instead.


Our software has to run on Oracle and SQLServer. At the moment, the modules that use sequences are Oracle only but if we port those modules to SQLServer we would use sequence there, too, so as to keep the code as similar as possible.
Post #1293056
Posted Tuesday, May 1, 2012 7:59 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 8:28 AM
Points: 3,805, Visits: 1,229
Thanks for another SEQUENCEs question, I think I now understand how they work.

I agree with Marlon that defaults should not be used in sequences, as it is harder to debug when there is a problem.

"El" Jerry


"El" Jerry.

"A watt of Ottawa" - Gerardo Galvan

To better understand your help request, please follow these best practices.
Post #1293168
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse