Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select two table in two database

Status
Not open for further replies.

BudiBambang

Programmer
Sep 27, 2003
18
ID
Hi, I'm a new user in Sybase.

Suppose, I have a table Customer1 in Db1.db and Customer2 in DB2.db

How to select customer1.*,customer1.* ?

Thanks
 
hi

You will have to be logged in as sa for this and the DBs on the same sybase server. Off the top of my head, I think the following will do it:

select db2..customer1.*, db1..customer1.*
from db2..customers, db1..customers

hope that helps
lou

 
It's not necessary to be 'sa' just make sure that whatever loging you are using in the database issuing the command has acess to the other db.

Code example is right, but you may need to specify the 'owner' of the object.
Ex:
Code:
select * from db.dbo.table
[code=black]

-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR][/COLOR] and [CODE]
[/ignore] tags.

Ex:
Code:
SELECT 1 from sysobjects

 
hi JeanNiBee

Thanks for corrected me. I've only ever done a query like that once and I'm no Sybase expert, so I'm grateful for your helpful reply.

many thanks
lou

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top