April 4, 2013 at 12:04 pm
Hello!!!
I need a database from an Insurance company, but they don't want to give it because it has a column with the ID number of each patient and their medical history.
They will give it to me only if I can find a 'script' that allows them to switch that ID number, but I need to 'remember' same ID across all the dase...
For example,
If I have (in a column) the ID 12345 and you 54321, y must generate a new number for each one. It can be 1 for me and 2 for you; but each time it reads 12345 it has to change to 1 exclusively.
In conlution, it has to identify each person with a new ID number.
Thanks !!!
April 4, 2013 at 12:10 pm
would doing something like selecting a newid() help?
for example, have them do something like this:
SELECT
NEWID() AS RefID,
OtherColumnsButNotTheRealID
Into TableForExport
From tblPatients
--OR
SELECT
identity(int,1,) AS RefID,
OtherColumnsButNotTheRealID
Into TableForExport
From tblPatients
then have them send you the TableforExport, which would not have the sensitive column.
they could do the same for patient names as well, if they needed to...just select a number instead of a patient name.
Lowell
April 4, 2013 at 3:56 pm
or if you are lazy to list the column name do this.
SELECT NEWID() AS [NewID], * INTO NewTable
FROM ExistingTable;
ALT_R TABLE NewTable DR_P COLUMN OldID
*fill in the blank
April 5, 2013 at 3:19 am
lda17_04 (4/4/2013)
Hello!!!I need a database from an Insurance company, but they don't want to give it because it has a column with the ID number of each patient and their medical history.
They will give it to me only if I can find a 'script' that allows them to switch that ID number, but I need to 'remember' same ID across all the dase...
For example,
If I have (in a column) the ID 12345 and you 54321, y must generate a new number for each one. It can be 1 for me and 2 for you; but each time it reads 12345 it has to change to 1 exclusively.
In conlution, it has to identify each person with a new ID number.
Thanks !!!
It's usually the responsibility of the supplier to obfuscate sensitive data - they should be posting the question on ssc, not you!
Something like this:
-- sample data
DROP TABLE #SensitiveData;
SELECT *
INTO #SensitiveData
FROM (SELECT PatientID = 1, SafeStuff = '1' UNION ALL SELECT 2, '2' UNION ALL SELECT 3, '3' UNION ALL SELECT 1, '1') d;
-- generate the new keys
DROP TABLE #ObfuscatedKeys;
WITH DISTINCTPatientID AS (SELECT DISTINCT PatientID FROM #SensitiveData)
SELECT SensitiveOldKey = PatientID, SafeNewKey = NEWID()
INTO #ObfuscatedKeys
FROM DISTINCTPatientID;
-- switch keys for export
SELECT o.SafeNewKey, s.SafeStuff
FROM #SensitiveData s
INNER JOIN #ObfuscatedKeys o ON o.SensitiveOldKey = s.PatientID;
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
April 15, 2013 at 8:43 am
Thank you very much for the assistance! π
Yeah.... welll.. tell them that haha... Like always, if you want something you have to searched on your own.
I will send them these suggestions, I hope they work fine.
Thanks a lot !!!
Any other idea please let me know.
April 15, 2013 at 11:46 am
π
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply