8.3.08

New SequentialID in sql server

NewSequentialId() is a new function introduced in sql server 2005. It works similar to Newid() but produces consecutive id's.

Unique identifier generated were rely on time and not on space so it will take another millions of years to generate a duplicate id.
Code Snippet

DECLARE @VenkatTable table
( RowID int IDENTITY,
VenkatData varchar(20),
VenkatGUID uniqueidentifier DEFAULT newsequentialid() )


INSERT INTO @VenkatTable( VenkatData ) VALUES ('Venkatesan Data' )

SELECT * FROM @VenkatTable

No comments:

Post a Comment