locked
what do you mean sequence? RRS feed

  • Question

  • do you know about n sequnce of sql . we have sequence in oracle but how solve sequnce in sql .

    www,employermagazine.com

    • Edited by ferdousi Wednesday, January 16, 2013 2:35 AM
    Wednesday, January 16, 2013 2:32 AM

Answers

  • Hi ferdousi,

                In SQL Server , there are two options to automatically generate sequential numbers

               IDENTITY - http://msdn.microsoft.com/en-in/library/aa933196(v=sql.80).aspx ,

               from SQL Server 2012 ,SEQUENCE- http://msdn.microsoft.com/en-us/library/ff878091.aspx

                   


    Thanks & Regards, sathya


    • Edited by SathyanarrayananS Wednesday, January 16, 2013 2:44 AM
    • Proposed as answer by Naomi N Wednesday, January 16, 2013 2:55 AM
    • Marked as answer by Kalman Toth Wednesday, January 23, 2013 9:26 PM
    Wednesday, January 16, 2013 2:43 AM
  • Sequence can be created either

        Using TSQL statement or by
        Using SQL Server Management Studio (SSMS)

    Note : Sequence is an object that has start value, increment value and end value defined in them and this sequence can be added to a column whenever required rather than defining an identity column individually for tables.

    Lets take a quick look,

    How to create a SEQUENCE using TSQL Statements

        Sequence can be created using a Create SEQUENCE Syntax

    ------ Create a SEQUENCE object on schema "dbo" by the name of TEST_Sequence
    CREATE SEQUENCE TEST_Sequence
        AS INT
        START WITH 1
        INCREMENT BY 1
        MINVALUE 0
        NO MAXVALUE

    Many Thanks & Best Regards, Hua Min

    • Proposed as answer by Naomi N Wednesday, January 16, 2013 2:55 AM
    • Marked as answer by Kalman Toth Wednesday, January 23, 2013 9:27 PM
    Wednesday, January 16, 2013 2:54 AM
  • Blog article on sequence here: http://sqlblog.com/blogs/john_paul_cook/archive/2013/01/01/sql-server-2012-sequences.aspx

    www.minidba.com | Sql Server Performance Tuning & Monitoring Software

    • Proposed as answer by Naomi N Wednesday, January 16, 2013 4:05 AM
    • Marked as answer by Kalman Toth Wednesday, January 23, 2013 9:27 PM
    Wednesday, January 16, 2013 3:12 AM

All replies