|
CREATE SYNONYM
Create a synonym.
Syntax CREATE SYNONYM [Synonym_schema.] synonym FOR object object: server.[database].[schema].object database.[schema].object schema.object Key synonym The synonym to create Synonym_schema The schema in which the synonym is created.
Synonyms may be created with dynamic SQL.
Synonyms can be created for the following objects:
Table
View
local/global temporary table
Assembly (CLR) Stored Procedure/Table-valued Function/Scalar Function
Assembly Aggregate (CLR) Aggregate Functions
Replication-filter-procedure
Extended Stored Procedure
SQL Stored Procedure
SQL Scalar Function
SQL Table-valued Function
SQL Inline-table-valued Function
The base object need not exist at synonym create time. It must obviously exist at run time.
Example
CREATE SYNONYM ss64 FOR MyDatabase.MySchema.MyTable;
GO
"A synonym is a word you use when you can't spell the word you first thought of" - Burt Bacharach
Related commands:
DROP SYNONYM
Equivalent Oracle command: