Click here to Skip to main content
14,924,426 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I want to retrieve data from two databases.

plz send me code.
Posted
Updated 15-Dec-10 13:12pm
v3
Comments
Henry Minute 15-Dec-10 19:13pm
   
Asking people to send you code, shows that you have made no effort, which is why your question has been down-voted. You are VERY lucky that people answered.

Try this,
SQL
select * from db1.dbo.table_db1 as A, db2.dbo.table_db2 as B where A.Bank_ID = B.Bank_ID
   
if just for join you can use JOIN with SELECT query
Selecting data from different databases[^]

[For SQL Server]If databases are in different locations or types then
use OPENROWSET[^]
or
OPENDATASOURCE[^]
or
Linked Servers[^]
   

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