Update table records

G

Guest

I have a table with 10k records (table 1). I made a copy of the database
with table 1 and gave it to another group. They updated the table, about 100
records and set a field to "shared" (table 2). I can run a select query to
produce records where the record ID are the same and the field =shared. I
need to copy the records from table 2 to table 1. There are about 100 fields
in the record. Is there a simple way to write back all the fields, or do I
have to specify each field in an update query?
 
S

Smartin

NewHeartMan said:
I have a table with 10k records (table 1). I made a copy of the database
with table 1 and gave it to another group. They updated the table, about 100
records and set a field to "shared" (table 2). I can run a select query to
produce records where the record ID are the same and the field =shared. I
need to copy the records from table 2 to table 1. There are about 100 fields
in the record. Is there a simple way to write back all the fields, or do I
have to specify each field in an update query?

100 fields in the record? That's a sure sign your table is not
normalized, but that's a separate issue...

To spare the pain of enumerating 100 fields in an UPDATE statement I
would consider this approach:

1) Create a linked table in your copy pointing to the table in the
remote copy

2) Execute a delete query to delete records in your copy where 'shared'
is true in the linked table

3) Execute an insert query in your copy to fetch records in the linked
copy where 'shared' is true

This all seems a bit risky though...

I would also consider normalizing the table design. It is very unusual
to require 100 fields in a table, even in very complex applications.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top