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 77923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:54:23+00:00 2026-05-10T20:54:23+00:00

The program that I am currently assigned to has a requirement that I copy

  • 0

The program that I am currently assigned to has a requirement that I copy the contents of a table to a backup table, prior to the real processing.

During code review, a coworker pointed out that

INSERT INTO BACKUP_TABLE SELECT * FROM PRIMARY_TABLE 

is unduly risky, as it is possible for the tables to have different columns, and different column orders.

I am also under the constraint to not create/delete/rename tables. ~Sigh~

The columns in the table are expected to change, so simply hard-coding the column names is not really the solution I am looking for.

I am looking for ideas on a reasonable non-risky way to get this job done.

  • 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. 2026-05-10T20:54:24+00:00Added an answer on May 10, 2026 at 8:54 pm

    Does the backup table stay around? Does it keep the data permanently, or is it just a copy of the current values?

    Too bad about not being able to create/delete/rename/copy. Otherwise, if it’s short term, just used in case something goes wrong, then you could drop it at the start of processing and do something like

    create table backup_table as select * from primary_table; 

    Your best option may be to make the select explicit, as

    insert into backup_table (<list of columns>) select <list of columns> from primary_table; 

    You could generate that by building a SQL string from the data dictionary, then doing execute immediate. But you’ll still be at risk if the backup_table doesn’t contain all the important columns from the primary_table.

    Might just want to make it explicit, and raise a major error if backup_table doesn’t exist, or any of the columns in primary_table aren’t in backup_table.

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

Sidebar

Ask A Question

Stats

  • Questions 339k
  • Answers 339k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Check out http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for. Looks like: {% for d in mydata… May 14, 2026 at 4:31 am
  • Editorial Team
    Editorial Team added an answer There's this project. Which is interesting. It might be possible… May 14, 2026 at 4:31 am
  • Editorial Team
    Editorial Team added an answer Aptana Jaxer is very neat. You can even manipulate the… May 14, 2026 at 4:31 am

Related Questions

I would really appreciate some feedback on what I am trying to achieve: The
First of all, I am aware that this question is dangerously close to: How
I have a for loop, and inside it a variable is assigned with var.
I am currently writing a WPF application which does command-line argument handling in App.xaml.cs

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.