SQL Server – What are Synonyms in SQL Server?

From the name itself we can guess that SYNONYMS are alias which is pointing to the Database objects.The use of synonym is to replace Multi part name SQL Statement into Single part name SQL Statement.

Synonyms can be created on only following objects.

  • Assembly Aggregate (CLR) Aggregate Functions
  • Assembly (CLR) Stored Procedure
  • Assembly (CLR) Table-valued Function
  • Assembly (CLR) Scalar Function
  • Replication-filter-procedure
  • SQL Table-valued Function
  • Extended Stored Procedure
  • SQL Scalar Function
  • SQL Inline-table-valued Function
  • SQL Stored Procedure
  • Table (User-defined)
  • View

Let us look the below code for more understanding.