USE TempDB
GO-- Create sequenceCREATE SEQUENCE dbo.SequenceID AS BIGINT
START WITH 3
INCREMENT BY 1
MINVALUE 1
MAXVALUE 5
CYCLE
NO CACHE;GO-- Following will return 3SELECT next value FOR dbo.SequenceID;-- Following will return 4SELECT next value FOR dbo.SequenceID;-- Following will return 5SELECT next value FOR dbo.SequenceID;-- Following will return which numberSELECT next value FOR dbo.SequenceID;-- Clean upDROP SEQUENCE dbo.SequenceID;GO
ไม่มีความคิดเห็น:
แสดงความคิดเห็น