sakura-bloom
sakura-bloom

Reputation: 4594

asp.net core identity - Id column is nvarchar(450) - why?

In the dbo.AspNetUsers table used by ASP.NET Core Identity the Id column is defined as nvarchar(450) as seen in the image below.

What is the reason for this, since Guids are stored in this column? If I am creating a foreign key referencing this Id column I don't really want to make the column unnecessarily large. Or is there a scenario when Id column of this size would be needed?

ASP.NET Core Identity Users table

Upvotes: 12

Views: 4378

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239300

I have no idea why it's 450 in length, but it actually doesn't matter. The NVARCHAR type is dynamically sized, so the the number it's fed is actually a max length. It will only consume the amount of bytes necessary to store the data it's storing, regardless of the "length".

Upvotes: 4

Related Questions