C # Use Guid. NewGuid (). ToString ()
Use NEWID () in SQL ()
The above method generates a 36-bit GUID. If you want to convert it to 32-bit, replace the '-' character.
SQL method: replace (newid (),'-','')
------------------------------------------
GUID (globally unified identifier) refers to the number generated on a machine, which ensures that all machines in the same time and space are unique. Generally, the platform provides APIs for generating guids. The generation algorithm is very interesting. It uses Ethernet Card addresses, nanoseconds, chip ID codes, and many possible numbers. The only drawback of GUID is that the generated result string is large ."
1. a guid is a 128-bit integer (16 bytes). When using a unique identifier, you can use this integer between all computers and networks.
2. The GUID format is "xxxxxxxx-xxxx-xxxxxxxxxxxx", where each x is a hexadecimal number in the range of 0-9 or a-f. For example, 337c7f2b-7a34-4f50-9141-bab9e6478cc8 is a valid GUID value.
3. No duplicate GUID value is generated on any two computers in the world (Koffer Note: it should be on the Earth. GUID is used to assign a unique identifier to a network or system with multiple nodes and computers.
4. On Windows, GUID is widely used: Registry, class and interface identification, database, or even automatically generated machine name and directory name.