Looking for dynamic SQL for cloning stats from a table.

UDA
Enthusiast

Looking for dynamic SQL for cloning stats from a table.

Does anyone have a sql that will clone stats for a table?
2 REPLIES
Enthusiast

Re: Looking for dynamic SQL for cloning stats from a table.

depends ...

if you want to duplicate an entire table with its stats,

create table a as b with data and stats;

but if you already have the table structure in place and copy over the stats definitions and values, you can do it using tset. (The .col file that tset generates has the collect stats sqls which inserts the stats)
JvR
Enthusiast

Re: Looking for dynamic SQL for cloning stats from a table.

There is also a macro by Dieter Noeth called GEN_DB_COLLSTATS which can be used for this purpose. It generates the collect statistics-statements for tables in a database. I think I got that one from the "other" Teradata_forums...

Good luck,

Jos van Raamsdonk
SNS-bank
Netherlands.