Hello everyone in this blog you will learn to create SAP HANA SQL synonym in SAP HANA. Lets get started.
What is SAP HANA SQL Synonym
SAP HANA SQL Synonym is an alternative name created for a table, view, procedure and sequence in SAP HANA. There are two types of synonyms
- Private Synonym
- Public Synonym
Prerequisites
You should have a table (or) view (or) procedure (or) sequence created in a schema
Syntax
Synonym can be created by using following SAP HANA SQL syntax
CREATE [PUBLIC] SYNONYM <synonym_name> FOR <table_name> or
<view_name> or
<procedure_name> or
<sequence_name>
Step-by-Step Procedure
1. Login to SAP HANA Studio.
2. Identify the table for which you want to create a Synonym. In this example i am going to create a synonym for the table “ARTCILE_INFO” which is in the schema “SAPLEARNERS”.
3. Right click on the table and choose New Synonym.
4. Provide the synonym name and click on Execute. Select Public checkbox to create a public synonym (or) leave it blank to create a private synonym. In this example i am creating a private synonym “SY_ARTICLES”.
5. After executing, a new private synonym will created successfully in the Synonym folder in the schema.
6. If you have selected the check box Public while creating the synonym in Step-4, a public synonym will be created in Public Synonym folder.
7. Now you can directly the query on the table with synonym name as below
SELECT * FROM P_SY_ARTICLES
Congrats! You have successfully created Synonym in SAP HANA. Please stay tuned for SAP HANA tutorials. Leave a comment in the below comment section and let us know your feedback.
Comments are closed.