Skip to Content

Exporting the MaxDB Table definition to files using SQLCLI and SQL Studio

Every database table has a definition that describes it. Any change made to this definition causes a direct impact on the table. Importing and exporting of data between different databases and database servers is a quite usual task. But there are situations where we might need to export and import the table definition also. This weblog shows you how the MaxDB table definition can be exported to files.

Table Definition in MySQL

Normally the command DESCRIBE is used to get the table definition. The definition so obtained can be just viewed. But the same cannot be exported. There is no specific command or method that helps to perform the same.

image

Export MaxDB Table Definiton to file using SQLCLI

In MaxDB SQLCLI the definition of the database table can be obtained using the command \DC followed by the table name. The same has been shown below.

image

But SQLCLI has \O command that helps in writing the results of executed queries to files. This command can be used to export the table definition to files. Thus the table structures can be easily moved across systems.

image

The above command creates a file with the EMPLOYEE table definition in it. The file created so is shown below.

image

There are a few limitations with these definitions; they cannot be used as such for creating tables in other systems. The files has to be modified to a query format to import them into other systems. But this can be overcome using the SQL Studio.

Export MaxDB Table Definiton to file using SQL Studio

The SQL Studio has a special utility called SQL Dialog, in which the table definition can be created as shown below.
1. Right click the table in the catalog Manager and choose Open Object Definition.
2. Right click the table definition and choose Export to SQL Dialog.
3. Right click the SQL Dialog and choose to Export to File.

image

image

image

Thus using these simple procedures the MaxDB table definition can be exported to file using the MaxDB SQLCLI and SQL Studio.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Alexander Schroeder
    For exporting and importing a schema (or parts
    of it), the MaxDB loader is more appropriate to
    use.

    Usually you do not only want to export a simple
    table, you may want to export tables together with
    associated indexes, views and constraints, default
    values and triggers. The sqlcli and the SQL Studio both will make that possible only with a
    lot of manual work.

    (0) 
    1. Kathirvel Balakrishnan Post author
      Hi,
      Thanks for the useful suggestion. Loader is really good and useful, but i opted for SQL Studio in this case because it can return the table definition as a query, which i think will be very much useful for creating the same table in any other system.
      Kathir.
      (0) 

Leave a Reply