Solved

Can "uniqueidentifier" value be generated based on Algorithm ? - SQL Server

Posted on 2011-09-28
2
237 Views
Last Modified: 2012-08-14
Hi,

Can we create an "uniqueidentifier" value based on certain Algorithm ? I want to make sure that all the values of the "uniqueidentifier" column must satisfy one Algorithm - for data integrity. Please do NOT provide about Encryption.

Thanks
0
Comment
Question by:milani_lucie
[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
2 Comments
 
LVL 28

Accepted Solution

by:
strickdd earned 250 total points
ID: 36719647
Create the column as type "UniqueIdentifier" and then when you add to it you can call "newid()"

newid() is a build-in SQL function that will make sure the GUID is globally unique or at least unique at the server level - depends on your setup.

If you are using a coding language, there are ways to produce GUID's there too.
0
 
LVL 6

Assisted Solution

by:judgeking
judgeking earned 250 total points
ID: 36816024
You don't need to have a column of type 'uniqueidentifier' in your DB table, you can just make it 'int' (or something else).  Then just make that column the primary key and define it as 'unique' in the table designer.  Whenever you add a row, just supply a new ID along with your other data (ensuring it's unique by whatever method you use).

Do you have the algorithm to generate your IDs, or do you need one?
0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

615 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