Sunday 15 February 2015

Getting creation-SQL of a table in HP Vertica using a query -



Getting creation-SQL of a table in HP Vertica using a query -

i using hp vertica db engine. there tables created in database. have requirement wherein need create-table script of table given table name querying on system-table or stored-proc or otherwise. help in reaching need highly appreciated. thanks.

the easiest way table definition table using export_tables(). function allows multiple objects scope.

you can script export statement , execute within script, such as:

select 'select export_tables('''', ''' || table_schema || '.' || table_name || ''');' v_catalog.tables;

alternatively, can roll schema level using:

select export_tables('', 'schema');

the difference beingness export_tables not produce definition projections associated table. if need projection table definition, utilize export_objects.

sql vertica

No comments:

Post a Comment