Wednesday, March 28, 2012

How to create named query across 2 different data sources?

I have a scenario where i need to create a named query between 2 tables are in 2 difference data sources. Iam not sure how to create one for this case. The named view UI forces to pick one data source and validates both the table against it. ( in my case the second table belongs to a different data source). I even tried using the data souce name as prefix and forming the query directly and nothing seems to work even though the documentation clearly mentions that we can create named queries across multiple data source. Any ideas on how to do this? Do i have to use a OpenRowset and directly try to use the second table from a different data source?I ran into the same problem, where my lookup tables were in one database (SQLServer 2k5) and my fact tables were in another database (SQLServer 2k). I ended up copying my lookup tables over to the 2k machine, and eliminating one of my datasources.

What i wanted to try (and maybe you could) was create a linked server between the 2 database servers, and just reference the other machine in your named query.

I never got around to it, because my DBA said there was some problem (pre SP2 i think) with creating linked servers between 2k and 2k5.

Anyway, if you can create the linked servers, i'd give it a go.

Csql

No comments:

Post a Comment