create sequence MySeq as int
start with 1 -- Start with value 1
increment by 1-- Increment with value 1
minvalue 0 -- Minimum value to start is zero
maxvalue 100 -- Maximum it can go to 100
no cycle -- Do not go above 100
cache 50 -- Increment 50 values in memory rather than incrementing from IO
SELECT NEXT VALUE FOR dbo.MySeq AS seq_no;
SELECT current_value FROM sys.sequences WHERE name = 'MySeq';
No comments:
Post a Comment