Click here to Skip to main content
15,908,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to fetch data on same page from two different databases on same server.i am little confuse about how can i do it.please help as soon as possible
Posted

This is quite easy really.

You can access the tables as below -

SELECT * from [Database1].[TableA]
SELECT * from [Database2].[TableA]


This is the standard across many databases.
 
Share this answer
 
Comments
Wendelius 24-Aug-12 17:52pm    
Exactly.
use [dboname].dbo.table name....

as this way u can use any number of database.


:)happy coading:)
 
Share this answer
 
Comments
ambujmalviya 24-Aug-12 5:52am    
i am getting data on first row but it show error from the next row.why it happens..?

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