how to link two different database in same SQL Server instance and send queries between them
+5
A:
use like below.
DB1.dbo.TableFromDB1
DB2.dbo.TableFromDB2
DB - database
Saar
2009-12-07 11:42:39
+1
A:
Look at using synonyms "CREATE SYNONYM".
You can access the databases directly with a full path. But, that code will break if the database is ever renamed or changed.
Using a synonym, the code can remain unchanged; when the database moves, just update the synonym.
This can be useful when you have a test and production environment. The code does not have to change just because you move it from test to production and the database names do not have to be identical.
Darryl Peterson
2009-12-07 12:46:07