Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-28
2
Medium Priority
?
238 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 1000 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

719 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