Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

DROP SYNONYM (Transact-SQL)

 

Applies To: SQL Server 2014, SQL Server 2016 Preview

Removes a synonym from a specified schema.

Topic link icon Transact-SQL Syntax Conventions

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.


DROP SYNONYM [ schema. ] synonym_name

schema

Specifies the schema in which the synonym exists. If schema is not specified, SQL Server uses the default schema of the current user.

synonym_name

Is the name of the synonym to be dropped.

References to synonyms are not schema-bound; therefore, you can drop a synonym at any time. References to dropped synonyms will be found only at run time.

Synonyms can be created, dropped and referenced in dynamic SQL.

To drop a synonym, a user must satisfy at least one of the following conditions. The user must be:

  • The current owner of a synonym.

  • A grantee holding CONTROL on a synonym.

  • A grantee holding ALTER SCHEMA permission on the containing schema.

The following example first creates a synonym, MyProduct, and then drops the synonym.

USE tempdb;
GO
-- Create a synonym for the Product table in AdventureWorks2012.
CREATE SYNONYM MyProduct
FOR AdventureWorks2012.Production.Product;
GO
-- Drop synonym MyProduct.
USE tempdb;
GO
DROP SYNONYM MyProduct;
GO

Community Additions

ADD
Show:
© 2015 Microsoft