Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Cross-database joins... Expand / Collapse
Author
Message
Posted Monday, November 24, 2003 7:47 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, January 18, 2009 11:30 AM
Points: 201, Visits: 5
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.



Post #18521
Posted Monday, November 24, 2003 7:57 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, November 21, 2014 6:34 AM
Points: 6,259, Visits: 2,031
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
Post #88497
Posted Monday, November 24, 2003 8:05 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, January 18, 2009 11:30 AM
Points: 201, Visits: 5
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?





Post #88498
Posted Monday, November 24, 2003 8:24 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, November 21, 2014 6:34 AM
Points: 6,259, Visits: 2,031
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
Post #88499
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse