Solved

Generating ID and GUID

Posted on 2008-10-11
7
423 Views
Last Modified: 2012-08-14
I have defined a PatientInfo table with following fields

PatientGUID      uniqueidentifier  not NULL
PatientID           bigint                 not NULL
LastName          Varchar(50)       not NULL
FirstName          Varchar(50)       not NULL
MiddleName       Varchar(50)
Gender              SmallInt             not NULL
VoterID              Varchar(50)
PAN                    Varchar(50)
DLNo                  Varchar(50)

PatientID can be a incrementing number starting from 1 while PatientGUID has to be generated in such a way that no two patient records have same GUID even on different installations - may be adding NIC MAC address or something.

What is the best way to generate these IDs?
0
Comment
Question by:sunnycoder
[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
  • 4
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
rionroc earned 300 total points
ID: 22696593
Hello

The best way to generate GUID is the finger print template.
But in your case, since there is no device attach with your program, you can use the ( PATIENT ID + LastName + Firstname  + Middle Name + Gender + Voter ID)

eq.
Patiend id: 234
Lastname: Roc
FirstName: Rob
MiddleName: Tab
Gender: Male
Voter id: 125

Bring out the first letter or number:
Result is:
Patient GUID: 2RRTM1

Or you can add some digits for long trusted Globally Unique Identifier.


Great is our GOD.
:)
0
 
LVL 12

Expert Comment

by:rionroc
ID: 22696612
Oh!

You can add also the date like:
Patient GUID: 2RRTM1-OC0812
OC is for month october
08 is for year 2008
12 is for day 12

You can also add the time.
Patient GUID: 2RRTM1-OC0812-141505
14 is for the hours
15 is for the minutes
05 is for the seconds

I don't think there will be an identical GUID for that system.
And also it is an autogerated GUID if you apply that.


Great is our GOD.
:)
0
 
LVL 45

Author Comment

by:sunnycoder
ID: 22696617
VoterID is not a mandatory field - that increases the chance of a clash. Wondering if same patient registered at two different installation should have the same patientGUID. If yes then system specific GUID might be a bad ... hmm I need to give this a second thought.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 12

Expert Comment

by:rionroc
ID: 22696724
Hello

>>VoterID is not a mandatory field.
Well don't include the Voters ID in our GUID system.

>>Wondering if same patient registered at two different installation should have the same patientGUID.
It's not bad at all, our guid system has a date and time value, so it will never have an identical id.


Great is our GOD.
:)
0
 
LVL 13

Assisted Solution

by:TechTiger007
TechTiger007 earned 200 total points
ID: 22696779
For creating PatientID you can create a "Sequence" in your database
http://www.ss64.com/ora/sequence_c.html.
In your code you will have to call SequenceName.NextVal, the value will be auto incremented by your database so you wont have to worry about creating/incrementing it

For creating a GUID you can use .NET's built in GUID class
GUID.NewGUID() will give you a globally unique identifier which uses NIC, current time, etc to create an unique identifier every time

Hope that helps
0
 
LVL 12

Expert Comment

by:rionroc
ID: 22697148
Hello TechTiger007


Thanks for that answer, it gives direction to my comments for sunnycoder.



Great is our GOD.
:)
0
 
LVL 45

Author Closing Comment

by:sunnycoder
ID: 31505406
Thank you
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

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