All existence, type, and permissions checking on the base object is deferred until run time. The binding between a synonym and its base object is by name only. You can create synonyms for the following database objects:įour-part names for function base objects are not supported.Ī synonym cannot be the base object for another synonym, and a synonym cannot reference a user-defined aggregate function. Because there is no ALTER SYNONYM statement, you first have to drop the synonym, RemoteObjects.EmpTable, and then re-create the synonym with the same name, but now point the synonym to the new location of the Employee table.Ī synonym belongs to a schema, and like other objects in a schema, the name of a synonym must be unique. Also, if the location of the Employee table changes, you will have to modify the synonym, EmpTable, to point to the new location of the Employee table. Now, the client application only has to use the two-part name, RemoteObjects.EmpTable, to reference the Employee table Server1. To address both these issues, you can create a synonym, EmpTable in a dedicated or existing schema, RemoteObjects, on Server2 for the Employee table on Server1. Also, if the location of the table were to change, for example, to another server, the client application would have to be modified to reflect that change. To reference this table from another server, Server2, a client application would have to use the four-part name. Provides a layer of abstraction that protects a client application from changes made to the name or location of the base object.įor example, consider the Employee table of Adventure Works, located on a server named Server1. Provides an alternative name for another database object, referred to as the base object, that can exist on a local or remote server. Applies to: SQL Server Azure SQL Database Azure SQL Managed InstanceĪ synonym is a database object that serves the following purposes:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |