473,655 Members | 3,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combining tables from different databases

Hi.

I'm currently working on a project which involves the creation of a
web page which reports selected data to customers from two back-end
systems. I use ASP script language on IIS, the server is MS SQL 2000.
Now I'm struggling with combining two tables from the different
databases. I'm sure it's simple enough, but I'm a little short on the
SQL expertise.

I've got two databases, db1 and db2, and then two tables, db1.t1 and
db2.t2. I need to combine these two tables (both tables have a
matching key field) to make a list of all items from db1.t1, and those
who correspond from db2.t2.

I can list all items from db1.t1, but I can't seem to get the db2.t2
joined in.
Can anybody help me with the syntax for this, please ? Help !

Answers, hints & tips greatly appreciated.
Thanks in advance !
Kenneth
Jul 20 '05 #1
2 7347
Hi

You will need three part naming to do this

Use DB1 -- Connected to DB1!

SELECT t.Fld, s.Fld
FROM t1 t JOIN db2..t2 s ON t.Fld = s.Fld

John

"Kenneth Fosse" <ke**********@h otmail.com> wrote in message
news:a4******** *************** ***@posting.goo gle.com...
Hi.

I'm currently working on a project which involves the creation of a
web page which reports selected data to customers from two back-end
systems. I use ASP script language on IIS, the server is MS SQL 2000.
Now I'm struggling with combining two tables from the different
databases. I'm sure it's simple enough, but I'm a little short on the
SQL expertise.

I've got two databases, db1 and db2, and then two tables, db1.t1 and
db2.t2. I need to combine these two tables (both tables have a
matching key field) to make a list of all items from db1.t1, and those
who correspond from db2.t2.

I can list all items from db1.t1, but I can't seem to get the db2.t2
joined in.
Can anybody help me with the syntax for this, please ? Help !

Answers, hints & tips greatly appreciated.
Thanks in advance !
Kenneth

Jul 20 '05 #2
You need to add it as a linked server then use the fully quaklified name
server.database .ownername.tabl ename

Look up sp_addlinkedser ver in BOL

HTH

Ray Higdon MCSE, MCDBA, CCNA

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12741
by: John Baker | last post by:
Hi: I just ran an Access application on someone elses system (With Access 2002). I made some changes (on his system) and then copied the program (data and program are still on the same file) onto a memory stick and put the whole package back on my system. I now have some tables I never had before, and cant get rid of them! They are MysysAccessObjects;MysysACEs;MysisObjects and a number of other tables with Mysis as the prefix. They are...
1
4199
by: Prakash RudraRaju | last post by:
Hi, I have recently migrated MSAccess Tables (nearly 120) to MySQL. To test successful migration I want to compare all tables. I have linked MySQL tables through ODBC connection. I want to create a report that compares all records between all tables in both databases. I am looking for a report with differences in number of records and differences in fields if 2 records are different. Probabaly it can be acheived through query, but I...
1
1411
by: Reidar Jorgensen | last post by:
I have several databases, identical in structure but with different data. Is there an esay way to combine all the data into one big database? There are six tables.
3
4524
by: Odawg | last post by:
Hello All Database (Access) Guru's, I am a novice when it comes to databases and I know enough to get simple information for my needs. With that said, I was given an opportunity for improvement a database. heres the scenario or process that I am facing 1. A total of 3 text files are generated from the mainframe and save to a secure network share. In each text file only raw data
7
3046
by: Frank | last post by:
Hi there, I'm trying to generate a report for an old database and I'm having trouble coming up with an elegant way of going about it. Using cursors and other 'ugly' tools I could get the job done but 1) I don't want the report to take ages to run, 2) I'm not a big fan of cursors! Basically there are tables that track history and each table tends to track only a specific value housed within a date range. I'm trying to combine the tables...
6
1877
by: robertmeyer1 | last post by:
Hi, There are several databases that have the same tables, with different reocrds. I need to be able to combine them all into 1 in an easy manner/best. How can I do this and are there potential problems for data corruption? Thanks. (All tables are exactly identical, its the same DB copied seveal times, each has different records entered that need ot be comboned.) thanks.
2
1705
by: enock | last post by:
Hi all, I have a distributed database environment. I need to bring all the data from the distributed centers into one central database. I have replicated all data from the different centers into their databases at the central location, I now need to be able to view the data as if it were in a single database. I have added a field that identifies the source of the data in all the different databases. I've tried replicating from the diffenrent...
1
1204
by: scolivas | last post by:
Hi, I have 2 databases - ALdata & SPdata I have 2 tables - vewDemoData (in ALData) & vewDemoDataSP in (SPData) both of these tables are identical in design, only the records are diff. I need to create a query that pulls data from both - and displays this data as if it were pulling from one table. fields in the tables are: RepID
2
4124
by: J055 | last post by:
Hi I need to search a number of DataTables within a DataSet (with some relationships) and then display the filtered results in a GridView. The Columns that need to be displayed come from 2 of the tables but the search needs check 3 or 4 tables. Do I need to create a new DataTable which has the columns from both the tables so I can display in the Gridview or can I get the columns somehow from the DataSet without creating a new table? I...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.