question

hobbsa avatar image
hobbsa asked

I am in need of hooking two databases together, same server. The fields for this report are all in one table but the prompts are in a different table, different database. How do i join them??

I am in need of hooking two databases together, same server. The fields for this report are all in one table but the prompts are in a different table, different database. How do i join them??
sqldatabasejoin
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sjimmo avatar image sjimmo commented ·
Can you please go into more detail about what you are trying to do? Can you also provide table schemas and tell us what you have tried so far?
0 Likes 0 ·

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
You could try using three-part naming convention? When you write your SELECT statements, reference the objects in three parts - databasename, schemaname, objectname. eg: SELECT * FROM ReportFields.dbo.FieldsTable LEFT JOIN ReportPrompts.dbo.PromptTable ON ... Without more detail, it's hard to know what else to suggest.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.