

Use CREATE SYNONYM in T-SQL to create a new synonym in SQL Server. Create SynonymĪ few points to consider while creating a synonym:Ī synonym must have a unique name just like other database objects in a schema.Ī synonym cannot be a base object for another synonym.Ī synonym cannot reference a user -defined aggregate function. In this scenario, you can create a Synonym for the Employee table which can be used in the client application. Now, the remote client application has to refer to this table with full name like MyDBServer.HR.dbo. Synonyms must be the same part of speech. Their meanings are similar and can be interchanged with one another. The words amazing, astounding and marvelous are all synonyms. They are used to add variety to writing and speech and allow you to avoid repetition. It provides a layer of abstraction and protects the client application in case of a name change or location change made to the base object.įor example, the local MyDBServer contains the HR database that includes the Employee table. Synonyms are words that share meanings with other words. In SQL Server, the synonym is the database object that provides alternate name (alias) to another database objects such as table, view, stored procedure, etc. SQL Server - GRANT/REVOKE Permissions to User.
