Friday, March 30, 2012

Named Query on tables in separate dbs?

Is it possible to write a named query on tables in different databases?Sure, just use your standard TSQL syntax..

Select
A.field1,B.field2
from DB1.user.tablename A inner join DB2.user.tablename B
on A.ID = B.ID

C|||Actually I do not want to hard code the database name in the query. Can I use the datasources somehow?|||I have not been able to query across datasources.

If you just want to query one db, then you could create a view in one db that queries both dbs.

No comments:

Post a Comment