Solved

Generating ID and GUID

Posted on 2008-10-11
7
421 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

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 …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 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