Generate Create Table DDL SQL Script of SAP HANA Database Table
In this SAP HANA database tutorial, I want to share with SQLScript developers how to generate Create Table commands of selected HANA database tables. On SAP HANA Studio, this feature is now visible easily so I just wanted to provide this hint for SQL programers that require to extract DDL script of their database tables.
Since in general SAP tables have huge numbers of columns in HANA database, it is difficult to create these SQL statements manually.
Database developers frequently require CREATE TABLE SQL commands for selected database tables and in general they use the database's native database management tool to generate DDL scripts of those table. Database management tools provide DDL scripts for SQL database developers to let them Create those tables on other databases or backup the generated Create Table commands.
I recently require to generate a number of SAP HANA database tables' Create Table commands in order to execute these DDL statements on an other HANA database.
First launch SAP HANA Studio.
Using SAP HANA Development perspective, connect to the HANA database that you want to create DDL SQL scripts
Under catalogs find the related schema and under Tables node find your target database table.
Double click on table name or right click on highlighted table name and from context menu choose "Open Definition"
When the table definition is displayed on a new screen, on the upper right corner, you will see the Export SQL icon. Click on it to export Create DDL SQL statement of the database table.
On a new SQL editor screen, automatically generated Create Table DDL SQLScript command will be displayed as follows
Another option is using SAP HANA Studio Export Wizard especially if you have a quite number of database tables to generate SQL Create Table DDL statements or if you want to script HANA database tables with data stored in those tables.