November 24, 2003 at 7:47 am
Hi,
I'm in need of some advise on cross-database joins, i.e. is it possible? What are the performamce implications? Is there a better way to achieve the following?:
I'm developing an online forum as an additional service for an established group of users, but for political reasons I'm not able to modify the database that contains the users login credentials. Therefore, I currently have two databases (one containing user accounts, the other containing forum threads/messages/etc.) on the same physical MS SQL 2K server.
When displaying the forum messages, I need to also display information that resides in the other database (name, address, etc. of the poster). How do I go about this? Is it possible to do a cross-database join in this manner?
Any suggestions would be most appreciated.
Thanks.
November 24, 2003 at 7:57 am
Yes.
You can use 3 part Name like [DBname].[tableName].[Column] on the FROM Clause, but you must be aware about the crossdatabase ownership change. If all aobjects are ownned by dbo and NO user has db_ower priviledges then is not a big deal (If you are on SP3a make sure to enabled it) but if the above is not true check all the implications before you jump in!
HTH
* Noel
November 24, 2003 at 8:05 am
Thank you, I'll give that a go.
For reference, all objects are owned by dbo and the account being used has only public, db_datareader, db_datawriter... but what would happen/be the difficulty if that was not the case?
November 24, 2003 at 8:24 am
with crossdatabase ownership enable a user that has db_owner permission on database "A" will automatically have db_owner permissions on "B" I don't know if you would like that, its very dependent on the enviroment. If more than one team uses the same SQL Server box it may not be a good idea!
HTH
* Noel
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply