I have a need to write some common queries that will work across multiple databases (all on the same server). The databases all have the same schema but are 3rd party so I am not allowed to create Stored Procedures or User functions in these databases. For this reason I have a separate database to hold the stored procedures and use synonyms to access the tables in the databases.
The number of databases may increase as the company involved is buying up other companies many of which use the same software/database combination. At present there are at least 4 such databases in use.
The queries will be executed from a .NET application so unions can be achieved by not clearing the data from a datatable before filling it.
I can see a number of ways of doing this but I'd like to know if there's something I'm missing.
My intention is to provide a means of creating new Synonyms for each 3rd party database in the private database and then to create stored procedures that use these synonyms from a master set of stored procedures. All this seems to be pretty straightforward even though to my mind it's a bit clunky. If only SQL allowed textual substitution!
So have you any suggestions as to a better approach to this problem?
Regards
The number of databases may increase as the company involved is buying up other companies many of which use the same software/database combination. At present there are at least 4 such databases in use.
The queries will be executed from a .NET application so unions can be achieved by not clearing the data from a datatable before filling it.
I can see a number of ways of doing this but I'd like to know if there's something I'm missing.
My intention is to provide a means of creating new Synonyms for each 3rd party database in the private database and then to create stored procedures that use these synonyms from a master set of stored procedures. All this seems to be pretty straightforward even though to my mind it's a bit clunky. If only SQL allowed textual substitution!
So have you any suggestions as to a better approach to this problem?
Regards