| Author |
Topic Search Topic Options
|
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Topic: Three Databases? Posted: 10 April 2003 at 5:17pm |
Is it possible to open up three databases in the same ASP file (three different variables set to Server.CreateObject("ADO etc...) and then open up a recordset for two of them, and use the SQL statement "INSERT INTO" to put the values from the two other databases into one? I'm wondering, with the insert into statement how does it know which database to insert into, is there another field where you can put the database name and the table name or no?
Thanks, Paul Morgan
|
|
|
 |
Coco Brown
Senior Member
Joined: 26 April 2002
Location: United States
Status: Offline
Points: 245
|
Post Options
Thanks(0)
Quote Reply
Posted: 11 April 2003 at 4:48pm |
yes, you can query over two databases, but you have to link them first. I would import the table you want from one database into another. Then query normally between the two tables. Use that info to create your new Insert SQL query and execute it.
As far as opening three connections, you can open up to 10 connections on the same page without getting an error. But my way would require you to only use two: the one you are querying from(that has the imported table), and the other one you are inserting into.
Hope this helps.
|
 |
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Posted: 11 April 2003 at 5:47pm |
how do you link the databases?
|
 |
Bunce
Senior Member
Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
|
Post Options
Thanks(0)
Quote Reply
Posted: 11 April 2003 at 10:47pm |
What database are you using.
You can 'link servers' in SQL Server and I imagine there is something similar in Oracel.
If you are using Access then theres a bit more trouble to go to.
Cheers, Andrew
|
|
There have been many, many posts made throughout the world...
This was one of them.
|
 |
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2003 at 6:36pm |
|
i'm using access 2000
|
|
|
 |
Bunce
Senior Member
Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2003 at 7:32pm |
Can the databases see each other?
If so, you can link tables from within the database itself. This will probably impact on performance a little, but might be the easier way.
Cheers, Andrew
|
|
There have been many, many posts made throughout the world...
This was one of them.
|
 |
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2003 at 7:37pm |
|
when you say "see each other" what do you mean?
|
|
|
 |
Bunce
Senior Member
Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2003 at 7:45pm |
Generally means the same server or through mapped drives etc.
Try it: Open up one of the databases- Insert -> Table -> Linked Table.
|
|
There have been many, many posts made throughout the world...
This was one of them.
|
 |