Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello..

I want to know how to connect two database in SQL.

Example1: SQL Database A to SQL Database B


Example2: SQL Database A to Oracle or any other Database.

please help me..


Thanks in Advance..
Posted

 
Share this answer
 
Try this:
SQL
SELECT a.userID, b.usersFirstName, b.usersLastName  FROM databaseA.dbo.TableA a inner join database B.dbo.TableB b  ON a.userID=b.userID

You can't do that on fly directly. You have two options:
1. Create a linked server in DB invironment, then create a SP to take care of it.
2. Get two DataSets for them, then merge two datatables into one based on usersID.
If this solves your issue kindly up vote and mark this as solution.. Thanks..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900