Nishanth Reddy
Nishanth Reddy

Reputation: 609

System table or stored procedure in Netezza to get create-table-sql of a table

I need to extract the create-table-sql of a table created in a database in Netezza, by using a query executed from a program. If there is any system table, stored procedure or otherwise, which let's me do that, please let me know. Your help will be highly appreciated.

Upvotes: 1

Views: 3153

Answers (2)

sam
sam

Reputation: 11

If you have netezza SQL Aginity Editor 4.1 or above, then the following helps:

  1. Right click on the tablename in the Object Browser Pane
  2. Hover over Script in the menu
  3. Click on 'DDl query to new window'

This will give you the SQL code required to create the table.

Upvotes: 0

Peter
Peter

Reputation: 27944

The create statements are not saved in a table, however you can query the table structure from the system tables in you database. A good start is NFORMATION_SCHEMA.COLUMNS:

select *
from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME='tableName'

All information on the create parameters is stored in the system tables like TABLES.

Dumping information about a table:

exec sp_help 'tableName'

Upvotes: 1

Related Questions