Oracle sequence but then in MS SQL Server
Posted
by Raymond
on Stack Overflow
See other posts from Stack Overflow
or by Raymond
Published on 2009-03-19T12:19:36Z
Indexed on
2010/04/28
14:53 UTC
Read the original article
Hit count: 263
In Oracle there is a mechanism to generate sequence numbers e.g.;
CREATE SEQUENCE supplier_seq
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1
INCREMENT BY 1
CACHE 20;
And then execute the statement
supplier_seq.nextval
to retrieve the next sequence number.
How would you create the same functionality in MS SQL Server ?
Edit: I'm not looking for ways to automaticly generate keys for table records. I need to generate a unique value that I can use as an (logical) ID for a process. So I need the exact functionality that Oracle provides.
© Stack Overflow or respective owner