Solved

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

Posted on 2011-09-28
2
236 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

759 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