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

  • Home
  • SEARCH
  • 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 8201155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:42:44+00:00 2026-06-07T06:42:44+00:00

I am currently transferring data from one database to another. My problem occurs with

  • 0

I am currently transferring data from one database to another.

My problem occurs with a newly designed table. The old table consisted of the columns:

car1, car2, car3, id1, id2, id3, id4, idtxt, idtxt2  
(id types could be the same for multiple rows)  

The rows would have a specific combination to car1, 2, 3 with a specific id for each combination. id1 is always filled, while 2,3,4,txt,and txt2 may or may not be filled.

My new columns are consisted of:

car1, car2, car3, idtype, id#,text

In this new table idtype is = to id1, id2, id3, id4, id5(idtxt), and id6(idtxt2) while id# is = to the row values of the id in table one. This means there will be more rows than in the old table since there will be a row for each id# even if they are the same combination.

How would you go upon transferring this information through a stored procedure?

I currently can only think of running multiple stored procedures that consist of insert into statements, but can’t seem to find any answers as to how i would go upon inserting a certain value in addition to transferring the data. ie (idtype = id1 for all of this transfer)

I am also convinced this isn’t the most efficient way.

Please tell me if clarification is needed. Thanks!

Edit, I have figured out how to insert specific values during a data transfer. Other problems/ suggestions still stand.

  • 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-06-07T06:42:47+00:00Added an answer on June 7, 2026 at 6:42 am

    If I understand correctly what you are doing, you can do it with a simple query.

    It sounds like you are trying to normalize the data, by taking fields pivoted in the first table and unpivoting them in the second.

    select car1, car2, car3, 'id1' as idtype, id1
    from t union all
    select car1, car2, car3, 'id2', id2
    from t union all
    select car1, car2, car3, 'id3', id3
    from t union all
    select car1, car2, car3, 'id4', id4
    from t union all
    select car1, car2, car3, 'id5', idtxt
    from t union all
    select car1, car2, car3, 'id2', idtxt2
    from t
    

    You can save this into another table by creating the destination table and inserting, or by using “create table as” or “select into” (depending on the database you are using).

    For instance, if you are creating the table, your code would look something like:

    create table <new table in new database> (
        <tablename>id int primary key identity(1,1),
        car1 <some type>,
        ...,
        CreatedBy varchar(256) default system_user,
        CreatedAt datetime default getdate(),
    ); 
    
    insert into <new table in new database>(car1, car2, car3, idtype, id1)
        <select query above>
    

    Note: I’ve use SQL Server syntax for this, and included three additional columns: id, CreatedBy, and CreatedAt. (Almost) all tables should have these columns.

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

Sidebar

Related Questions

I'm transferring data from one database to another (upgrading a system) and have a
We are currently transferring our websites from Windows 2003 (32-bit) to Windows 2008 (64-bit)
I'm looking for method of transferring user entered data from a banner Advertisement to
I am currently in charge of transferring a site from its current server to
I'm transferring a project from Java to C++ and I have a problem with
I use something like below to pass information from one unbound form to another
I would like some advice on the best approach for transferring DB data from
I am beginning to get into socket programming. Currently, I am transferring data between
Currently I'm starting a new Activity and calling finish on a current one. Is
We've been asked to start developing a standardised approach to transferring XML data in

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.