Solved

uniqueidentifier

Posted on 2002-04-02
1
692 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

717 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