sql - Teradata: how can I get the primary key and foreign key definition of a table? -
the tables there don't know how crated. want definition of primary key , foreign key of tables. how can that?
there several ways pk/fk info in teradata, might fail if there's no pk/fk defined table. , there's high probability (especialy fks) they're not defined in data warehouse. in case need external documentation on datamodel.
dbc.indicesv holds indexes, there's 1 row per column per index, e.g. 4 column pk results in 4 rows, defined in "columnposition" order:
"uniqueflag" = 'y' indicates it's unique index
"indextype" indicates how defined in create table: 'k' = primary key, 'u' = unique constraint, 'p' = primary index, 's' = secondary index
dbc.all_ri_childrenv holds defined fks.
if it's single table there's "help index my_table" indexes, in case prefer "show table my_table" returns full source code.
Comments
Post a Comment