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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to join two tables in different database?

Author  Topic 

alice
Starting Member

10 Posts

Posted - 2003-05-21 : 20:17:09
I want join two tables in different databases. How to do that?

1fred
Posting Yak Master

158 Posts

Posted - 2003-05-21 : 20:38:12
select * from datebase1.user.table, database2.user.table
where database1.user.table.id = database2.user.table.id

Go to Top of Page

alice
Starting Member

10 Posts

Posted - 2003-05-21 : 20:40:38
I want to describe my question:
I have a Story table, in this table, every story comes from a book.So this table has a StoryName and a corresponding BookID column. In another database, I have a Books table, every BookID has a BookName.If these two tables are in one database, I just join two tables , and I can know which story comes from which book.But the problem is that these two tables in different database,and I want to use StoryName, BookName in a big sproc(put StoryName,BookName in a temp table).What is the most simple way to get BookName from StoryName?

Go to Top of Page

alice
Starting Member

10 Posts

Posted - 2003-05-21 : 20:43:34
I saw your message,Ifred. Thank you. I will try it.

Go to Top of Page
   

- Advertisement -