Search This Blog

01 February 2011

What is synonym in SQL Server?

A synonym is a database object used to create aliases for database objects. It is used to hide the actual name of an object from an application connected to the database. If the object is moved to another schema or server, it does not affect the application. After the object is moved, the path of the synonym should be changed according to the path of the object to which the synonym is associated.

Syntex to create and use synonym:
  • CREATE SYNONYM synonym_name FOR object name
  • SELECT * FROM synonym_name

No comments:

Post a Comment