0

I want to use id of identity in another table, and also I want to index that column but as you know the maximum length of index in Sql server is 450 characters, now I am not sure with this id format that Identity creates always below of 450 characters but here I want to know what is format of id that identity creates for example:

SELECT * FROM Users WHERE Id = 956f0873-10d2-4cb7-8d9c-660705e1ff66

for how many users the id will be below of 450 characters?

  • That value you've given there isn't 450 characters, it's a GUID (or `uniqueidentifier` in SQL Server terms). It will almost be in that format and I would suggest you'll find it nigh on impossible to run out of them. [There are 2^128 different values](https://stackoverflow.com/a/39776/3484879) – Thom A Sep 21 '19 at 15:28
  • thank you @Larnu for reply yes the length here is 36 characters but I am not sure it will be always below 450 characters – seyyed hamid shojaedin Sep 21 '19 at 15:30
  • It will always be 36 characters; never more, never less. [Comparing GUID and uniqueidentifier Values](https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/comparing-guid-and-uniqueidentifier-values) – Thom A Sep 21 '19 at 15:31
  • Thank you @Larnu I was not sure about it, but I get my answer from you – seyyed hamid shojaedin Sep 21 '19 at 15:33
  • it's a Guid global standard format and the length will remain the same for all users. – Abolfazl Sep 21 '19 at 16:35
  • If you store the GUID value in a SQL Server uniqueidentifier data type, the length of the actual value is 16 bytes. The formatted value will show as a hex string with dash separators in a front-end line SSMS. – Dan Guzman Sep 21 '19 at 17:26

0 Answers0