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)
 accessing Tw o tables from diffrent database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-01-19 : 09:54:55
Mash writes "Can I Access 2 diffrent tables from diffrent databse in store procedure.I have to compare values from one databse and on the basis of some diffrence I have to insert in other databse via store procedure.If this is not possible Pls suggest alternative for this."

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2004-01-19 : 10:09:45
It is possible, make sure you have the rights to access both DB's and don't forget the DB prefixes for the columns in your select statement.
Go to Top of Page

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2004-01-19 : 10:55:40
The table you are accessing in a SELECT statement may include the entire object name...

SELECT MyTable.* FROM DatabaseName.OwnerName.TableName MyTable

If you setup linked servers you can also reference the server name.
Go to Top of Page
   

- Advertisement -