***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Posts

    Wednesday, 18 December 2019

    Synonyms in SQL


    Synonyms in SQL

    Synonyms are the database object which is used to provide an alternative name to other database objects.
    Synonym can be used to specify with objects like:
    • Tables
    • Views
    • Stored Procedure
    • User-Defined Function
    Some points to be remember about synonyms:
    1. A synonym cannot refer to another synonym.
    2. Synonyms cannot be altered using ALTER statement. To modify the synonym you must DROP it and recreate.
    Create Synonym
    To create a synonym, simply specify a synonym name and name of database object to which it will be assigned.
    Syntax:
    Create SYNONYM  [schemaname.]synonymname FOR objectname;
    Example:
    create synonym suppliers for app.suppliers;

    Drop Synonym
    Syntax:
    DROP SYNONYM synonymname;
    Example:
    Drop synonym suppliers;

    No comments:

    Post a Comment