sequence in MS SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tiijnar
    New Member
    • Nov 2008
    • 14

    sequence in MS SQL

    Im using MS SQL Server as my database in a java application. I want to have something like sequence(of Oracle) in MS SQL. But I left with nothing.

    Is there any way to have a variable in MS SQL which is incremented automatically like a sequence(of Oracle)
    OR
    should I go for a procedure for this purpose?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by tiijnar
    Im using MS SQL Server as my database in a java application. I want to have something like sequence(of Oracle) in MS SQL. But I left with nothing.

    Is there any way to have a variable in MS SQL which is incremented automatically like a sequence(of Oracle)
    OR
    should I go for a procedure for this purpose?
    Variable, you might need to manually increment it inside your loop.

    Column, yes. Consider IDENTITY property of an numeric column.

    -- CK

    Comment

    Working...