Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Retrieve data from different database

Author  Topic 

karrentan
Starting Member

2 Posts

Posted - 2007-09-24 : 23:12:25
Hi, Im new to SQL 2005.
I want to know that, any way i can use to get data from different database?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-09-24 : 23:40:55
If the other db is on the same server,

SELECT * FROM DifferentDatabase.dbo.table.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-25 : 01:46:00
... and if its on a different server then create a Linked Server and then you can do:

SELECT * FROM LinkedServerName.DifferentDatabase.dbo.table.

Kristen
Go to Top of Page
   

- Advertisement -