I'm having newsequentialid () problems in sql server management studios. Create a table with a unique "UniqueID" column and set the default value to newsequentialid ().
Step 1. Saving the design:
Table "Table_1" - Error checking the default value for the "UniqueID" column.
Save it anyway.
Step 2. Browse sql:
CREATE TABLE [dbo].[Table_1]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](50) NOT NULL, [UniqueID] [uniqueidentifier] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Table_1] ADD CONSTRAINT [DF_Table_1_UniqueID] DEFAULT (newsequentialid()) FOR [UniqueID] GO
It looks reasonable.
Step 3. Add a few lines:
1 test 72b48f77-0e26-de11-acd4-001bfc39ff92 2 test2 92f0fc8f-0e26-de11-acd4-001bfc39ff92 3 test3 122aa19b-0e26-de11-acd4-001bfc39ff92
They do not look very consistent. ??
Editing: I got it to work a little, if the inserts are all done at once, then the unique identifier is consistent. On later inserts, the sql server seems to forget the last consecutive identifier and start a new sequence.
Running this in ssms leads to nasty commands:
insert into Table_1 (Name) values('test13a'); insert into Table_1 (Name) values('test14a'); insert into Table_1 (Name) values('test15a'); insert into Table_1 (Name) values('test16a'); insert into Table_1 (Name) values('test17a');
P aul source share