Solved

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

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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
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…

756 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