Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cooper123
Starting Member
1 Post |
Posted - 2009-03-31 : 03:56:47
|
| I am working on a system where we have multiple databases for various purposes. The typical architecture is that we have a number of stored procedures in each database to perform functions on the data stored in each base.Often though I feel the need of being able to join tables from different databases in one statement, which I know you can do by qualifying the database name before the table name.My problem with this however is that we have multiple environments (staging, test, development, production) and the database names are often not the same (sometimes we host multiple environments and databases on the same database host for example). So having hardcoded databasenames in the sql or stored procedures is not an alternative for us.Is there any workaround ? What I'm looking for would be some way to create an external symbolic reference to another database which you could use in your sql or similar ? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-31 : 04:03:54
|
Use SYNONYMs. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|