Sometime, we may need to reference tables and views across two or more databases. For example, in CRM extension development, we used to keep our extended store procedures and views in external database. Those stored procedures and views will pull out data from ORGNAME_MSCRM database.
In this case we have to refer objects from MSCRM database with four-part identifiers
It will be very time consuming job and very difficult to maintain the code, if we are referencing those four-part identifiers in our stored procedures and views. Moreover, SQL Server will never check validity and existent of base objects at synonym create time. So, the best way is used the program to generate synonyms in external database.
Below is the screen shots of my SQL Synonyms Generator program. It will read stored procedures, views and functions from source database and automatically create synonym at another database. You can also filtered sys objects by user defined data types.
- VS .NET Framework 2.0
Download Link:MSSQL Synonyms Generator (Application)
MSSQL Synonyms Generator (Source Code)