SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ETL: 22 char unique key in source to 16 char unique key in target?


ETL: 22 char unique key in source to 16 char unique key in target?

Author
Message
haggisns
haggisns
SSC Journeyman
SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)SSC Journeyman (92 reputation)

Group: General Forum Members
Points: 92 Visits: 41
Hi,

We are doing an ETL from one database into another database.

Our source data table has a primary key of 22 alpha-numeric. We need to load this into our target table (already with data) which uses
16 alpha-numeric characters. We have managed to logically shave off 4 characters down to 18 chars, but if we go down to 16 characters for our target table we lose uniqueness.

We do have other fields in the target table that we can make use of to hold data if this helps.

The situation is that we are pulling Accounts receivable from one app to an existing AR application. We are doing an intial load and then we will perform a nightly load process afterwards as the source app will continue to be used. The target app is where we perfrom our backoff financials, BI, etc. In the future the target app will be made decomissioned.


Just read a surogate ID article that might help but we need to be able to tie back our target table data to the source table in the source application as it is still being used.

Are there any strategies for going from 22 len field to 16 and not lose uniqueness but still be able to resolve between the 2 tables/applications for example (auditing purposes).

using SQL Server 2000

Thanks
Sergiy
Sergiy
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25139 Visits: 12464
I suppose you have some auto-generator for unique 16-char codes.
Let's say it's encapsulated in function dbo.GenerateUnique16key.

Then you should have something like this:

Create TABLE dbo.AccountIdentifiers (
TwentyTwo char(22) NOT NULL PRIMARY KEY,
Sixteen char(16) NOT NULL DEFAULT (dbo.GenerateUnique16key)
)



When new records arrive insert 22-char codes into this table.
Table will generate 16-chars unique codes and assign them to imported 22 char codes.

Then mapping (converting) will be easy once and forever.
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13865 Visits: 4639
Crazy idea... redefine key in target database, make it 22 chars in lenght.

_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search