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

  • 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

  • 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.

    _____________
    Code for TallyGenerator

  • 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.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply