Solved

uniqueidentifier

Posted on 2002-04-02
1
691 Views
Last Modified: 2012-06-21
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
Comment
Question by:powerfool
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
EstebanFG earned 50 total points
ID: 6913572
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question