It is a SQL Server object. It provides alternative names to all object except Database Name. We can create synonyms for table, views, stored Procedure, function etc.
It Provides a new layer of abstraction that protects a client application from changes made to the name or location of the base object. Remember, the name of a synonym must be Unique in a database.
Microsoft declared that a synonym cannot be the base object for another synonym, and a synonym cannot reference a user-defined aggregate function.
Operations
can be done
- SELECT
- INSERT
- UPDATE
- DELETE
- EXECUTE
- Sub-selects
We cannot reference a synonym that is located
on a linked server.
SQL query for Creating a synonym
USE
database_name;
GO
CREATE
SYNONYM synonyms_name
FOR
Database_name.Schema
name.table_name
GO
For Reference please visit
No comments:
Post a Comment