April 28, 2009 at 4:47 am
Hi,
The problem is :
I have a ENROLLMENT table that contains the HistoryDataBaseIDs (mapping : many to many).
I have 11 such different History Databases of Same Schemas and any user can have his data in any dataBase. Now I have to fetch the User's Records from these History DataBases without using CURSORS/LOOPING and I can use ONLY JOINS. So, Is there any possible way to dynamically join the Multiple databases.
Thanks in Advance
Himanshu
April 28, 2009 at 6:10 am
Yikes. That won't be easy. I'd try using a UNION between each of the different databases, assuming you know what they all are. That way, any given query against any given database can return nothing, but it will still not interfere with the next query against the next database.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 28, 2009 at 8:05 am
Hi,
I am adding some points here
1. Yes, I know the names of the DataBases, But over a period of time the number of databases can Increase. So we cant use UNION.
2. All databases are residing on same server also.
I was just wondering that would system tables help in this case...ie would there be a way to get data from the histories tables through system tables to help us for the join...
Need help ASAP
Himanshu
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply