Was this helpful?
DROP SYNONYM
Valid in: SQL, ESQL, OpenAPI, ODBC, JDBC, .NET
The DROP SYNONYM statement deletes one or more synonyms from a database. A synonym is an alias (alternate name) for a table, view, or index. Synonyms are created using CREATE SYNONYM.
Dropping a synonym causes the DBMS Server to re-compile any repeat query or database procedure that references the alias. Dropping a synonym has no effect on views or permissions defined using the synonym.
When a table, view, or index is dropped (using the DROP statement), all synonyms that have been defined for it are dropped.
The DROP SYNONYM statement has the following format:
[EXEC SQL] DROP SYNONYM [IF EXISTS] [schema.]synonym_name {, [schema.]synonym_name};
IF EXISTS
Suppresses error reporting for the specified object if the object does not exist and the user matches the schema.
synonym_name
Specifies the name of the synonym to be removed.
Embedded Usage
You cannot use host language variables in an embedded DROP SYNONYM statement.
Permissions
To drop a synonym that resides in a schema owned by the session's effective user, omit the schema parameter. To drop a synonym that resides in a schema owned by the session's effective group or role, specify the schema parameter.
Locking
The DROP SYNONYM statement takes an exclusive lock on the object for which the synonym was defined.
Related Statements
CREATE SYNONYM
Last modified date: 02/03/2024