Questions tagged [newsequentialid]

32 questions
2
votes
3 answers

How to use NEWSEQUENTIALID() after a table has already been created and has data?

Could anyone help me with this please. I have a table that's not unique (as I'm rummaging through old databases of my predecessor.) I would like to assign it to the "ID" field within the Fruits table I have. I'd like to go ahead and get the…
AriesTiger
  • 69
  • 1
  • 8
1
vote
1 answer

Is possible NEWSEQUENTIALID() repeat with NewId()?

I used to have a table with about 1000W data, the primary key column's datatype is uniqueidentifier, and the default value is Newid(). Now there is a performance problem, and I want to change the default value to NEWSEQUENTIALID(). Is it possible…
L.Tim
  • 61
  • 3
1
vote
2 answers

When using NEWSEQUENTIALID() as primary key, what should be my clustered index?

I'm using newsequentialid to generate GUIDs for my primary key in a table. According to the documentation (https://learn.microsoft.com/en-us/sql/t-sql/functions/newsequentialid-transact-sql?view=sql-server-ver15), Sequential GUIDs aren't guarantined…
Diskdrive
  • 18,107
  • 27
  • 101
  • 167
1
vote
2 answers

Guid is empty with newsequentialid() and EF database first

I'm working on a website using EF 4.1 and database first. I'm also using aspnet tables, particularly aspnet_Users which is using Guid as a primary key. Consequently, my custom User table also has a Guid as primary key, which is a foreign key to the…
1
vote
2 answers

How to import data with SSIS for sequential guids?

Is there anyway to import data into SSIS where I expect the PKs to be sequential guids? The only method I've been able to come up with so far is to create a temporary table with the column defaulting to newsequentialid() loading the data in there…
Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
1
vote
0 answers

Using Entity Framework 5.0 map relationship between parent and children when ID are Guids with newsequentialid()

I have two classes with a one to many relationship. public partial class Client { public Client() { this.Client_Local = new HashSet(); } public System.Guid Guid { get; set; } public string Name { get; set;…
1
vote
2 answers

In a stored procedure (SQL Server 2008 R2 SP2) is it possible to return a NewSequentialID() without a temp table variable?

In a stored procedure (using SQL Server 2008 R2 SP2) is it possible to return a NewSequentialID() without a temp table variable? I can successfully obtain the NewSequentialID() by using a temp table: Getting Value of NEWSEQUENTIALID() on…
George 2.0 Hope
  • 583
  • 1
  • 6
  • 21
0
votes
0 answers

newsequentialid() creating non-sequential IDs when inserts are 8s apart

I'm using SQL Server 15.0.4236.7 and have noticed that GUIDs are consecutive if the row inserts are <8s apart. Here are some examples: Inserts were 8s apart: Inserts were <8s apart: Why is this? sql server 2008 newsequentialid() problem does not…
David Klempfner
  • 8,700
  • 20
  • 73
  • 153
0
votes
2 answers

How to generate sequential alphanumeric string in Java starting with specific string

I want to be able to generate sequential alphanumeric strings of a given length 8. Also, I want the string to start with a specific string let's say "ABC00". Just imagine a license plate starts with a specific string and other generated alphanumeric…
Curious
  • 72
  • 7
0
votes
2 answers

Why is default newsequentialid() not working?

I have a table with a default id of newsequentialid, but the values being generated are not sequential. [Id] UNIQUEIDENTIFIER DEFAULT (newsequentialid()) NOT…
Oliver
  • 43
  • 6
0
votes
0 answers

newseqeuntialID vs bigint on replicated database

I recently started working on an application that has merge replication for offline scenarios. We have an int identity column that serves as the pk and clustering index. We also have uniqueidentifier column in each table because replication needs…
0
votes
3 answers

Simplify SQL Insert which uses NEWSEQUNETIALID() column default

I have the following insert stored procedure: CREATE Procedure dbo.APPL_ServerEnvironmentInsert ( @ServerEnvironmentName varchar(50), @ServerEnvironmentDescription varchar(1000), @UserCreatedId uniqueidentifier, @ServerEnvironmentId…
c0D3l0g1c
  • 3,020
  • 5
  • 33
  • 71
0
votes
3 answers

Get SQL Insert to work when PK is supplied or NOT

I have the following stored procedure: ALTER Procedure dbo.APPL_ServerEnvironmentInsert ( @ServerEnvironmentName varchar(50), @ServerEnvironmentDescription varchar(1000), @UserCreatedId uniqueidentifier, @ServerEnvironmentId…
c0D3l0g1c
  • 3,020
  • 5
  • 33
  • 71
0
votes
2 answers

Clustered GUID column and newsequentialid across servers

It is well known that using random values in a column with a clustered index isn't a good idea, which is why using GUIDs for a primary key with a clustered index is usually not recommended. Using the newsequentialid() function, we can overcome most…
kodbuse
  • 990
  • 2
  • 9
  • 20
0
votes
1 answer

SQL New Column Error Because of Newsequentialid

Hi I have a really big data and it has a column as ObjectID and its default value newsequentialid(). While I am trying to create new column with a default value on that table, I got this message ' Error validating the default for column…
Onur CAN
  • 81
  • 11