Importing data into a new db structure

  • We are re-developing an application that requires redesign of an existing db structure, and ultimately some of the data in the existing db is going to be represented in a different format.

    for example: a column in a user table has a list of job targets for that user. in the new structure there is a table which lists a standard list of job targets which will be represented in the new user table as the ID of that particular Job Target, instead of the name of it.

    So my question is this - is there a script that I can write during the import that will look at the values of the Jobtargets column in the old user table, check for its ID reference in the new JobTargets table, and then replace those values into the respective jobTarget column in the new user table?

  • Assume data types are the same

    Update a

     set jobtargets = b.id

    from old_jobtargets a

     inner join new_jobtargets b on a.jobtargets = b.jobtargets

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

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