How to create and use Sequence in Denali?

Rajnilari2015
Posted by Rajnilari2015 under Sql Server category on | Points: 40 | Views : 430
Let us first create a sequence as

CREATE SEQUENCE GenerateSequence
START WITH 1
INCREMENT BY 1;


After execution of this statement, we will find in the Sequences node a sequence object has been created.Once the sequence object is in place, we can create a table and populate it with the values

Create Table tblSequence
(
SequenceID int not null primary key
,SequenceData varchar(20) not null
);

Insert into tblSequence(SequenceID , SequenceData )
VALUES (NEXT VALUE FOR GenerateSequence, 'Data1'),
(NEXT VALUE FOR GenerateSequence, 'Data2')

SELECT * FROM tblSequence

Comments or Responses

Login to post response