At 11:20 PM -0600 1/26/06, michael munson wrote:
I have two databases, one has many fields I need, the other only has
one. Is it possible to go through the second database, and update
specific rows on the first?
DB1 has many rows, and DB2 has some. Every row in DB2 is in DB1 and
they both have the same value for the key row so they can be
cross-referenced. What is an easy way to merge DB2 into DB1?
First, open a connection to one of the databases, probably best the
one you are merging into. Then "attach" the second database. At
this point, you will see all tables of both databases visible to you
to do whatever with.
It may actually be easier to merge the two databases into a third, new one.
In which case, for each combined table, you can say something like:
INSERT INTO <dest> SELECT <list> FROM <src 1> UNION SELECT <list> FROM <src 2>
Adjust to taste.
Or if that doesn't work, then your application may have to iterate
through the rows of the source tables and insert conditionally into
the destination table.
-- Darren Duncan