Original: uniqueidentifier field type using SQL Server
SQL Server has been introduced since version 2008?uniqueidentifier
? field, which stores a UUID, or GUID, with an internal storage of 16 bytes. SQL Server can be generated by two functions?uniqueidentifier
, respectively?NEWID()
and?NEWSEQUENTIALID()
, which can only be used as the default value for a field. Java also has a UUID tool class?java.uti.UUID
,?UUID.randomUUID().toString()
? generate a random UUID string, in the?java.util.UUID
? It also uses two?long
The field represents the internal state.
SQL Server's? uniqueidentifier
? The Type field indicates how the interior is stored, and when we manipulate it, its external representation is a fixed format? xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
? A string that is not case-sensitive.
The SQL Server used in this article is version 2017, which starts with Docker.
Docker run-e ' accept_eula=y '-e ' sa_password=yourstrong (!) Password '-P 1433:1433-d microsoft/mssql-server-linux:2017-latest
Then we create a with a? uniqueidentifier
? A table of type fields? Read the full text >>
Using the uniqueidentifier field type for SQL Server