Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6641051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:45:54+00:00 2026-05-25T23:45:54+00:00

I have to import data from an old schema to a new one, where

  • 0

I have to import data from an old schema to a new one, where a column ‘career_name’ (in table ‘users’) that used to be a VARCHAR now should be an INTEGER which is a foreign key to another table careers. This way I intend to tipify the data that was stored in the VARCHAR column in order to keep integrity in my database.

Actually, I do the following:

  1. Create both new tables in the new schema
  2. Use SELECT DISTINCT 'career_name' FROM old_table in order to obtain all possible values
  3. INSERT into my new table careers the rows obtained above
  4. INSERT data into my new table users using a CASE clause in order to obtain the ID from table careers of the corresponding former career_name so the relation is created.

Now the problem is the following, the table careers is big, so writing one CASE clause for each row in the table in order to import users is nearly impossible.

Is there a way to avoid this? I wish I could use my table careers as an associative array, where the key was the former career_name and the value the row’s ID… Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:45:55+00:00Added an answer on May 25, 2026 at 11:45 pm
    INSERT into new_Users 
    SELECT Users.Name, careers.id
    FROM Users inner join careers ON Users.career_name = careers.career_name
    

    Because the schema isnt known to me, I am assuming that new_users table has 2 columns which is name and career_id.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data from an old table, with a lot of columns that
I have a Java Program that will import data from a DB2 table to
imagine a situation where you have an application that needs to import data from
I have the great joy of being forced to import data from an old
I'm actually working at MOSS 2007 project where I have to import data from
I have simple SSIS package where I import data from flat file into SQL
I have a problem using the SSIS. I try to import data from database
I will be doing an occiasional import from XML into core data. I have
I have an application that imports data from a pickled file. It works just
I have a C#/.Net job that imports data from Excel and then processes it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.