• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 704
  • Last Modified:

uniqueidentifier

hello, what's is uniqueidentifier datatype in MSSQL? I've just created a field with this type and trying to fill it, but i've got error message: "the value you entered is not consistent with the data type or length of the column" .. just curious ..
0
powerfool
Asked:
powerfool
1 Solution
 
EstebanFGCommented:
uniqueidentifier is used to store Global Unique Identifiers (GUID).  For example, the Unique ID's that are stored in your system's registry when a DLL is registered.
In order to fill it, you can try two things:
1) Use the NEWID function.
    Example:
       insert into <tablename>(<columnname>)
       values(newid())

2)  You insert a string with the following format:

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, in which each x is a hexadecimal digit in the range 0-9 or a-f.
For example, 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid uniqueidentifier value.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now