Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

How to determine the Identity column name for a table having such a column? - response (1) by VandeBergB

$
0
0

You need to spend some time familiarizing yourself with the dbc views. In particular, dbc.columns, which should answer your question.  The Teradata User Documentation will assist in your quest as well.
The following code snippet will create a small table with an identity column and interrogate said view to show you how dbc.columns keeps track of the columns in the database.
This should be a great learning experience!

CREATE TABLE <INSERT db name here>.ColumnTest
, NO FALLBACK
, NO BEFORE JOURNAL
, NO AFTER JOURNAL
, CHECKSUM = DEFAULT
(IDColumn  BIGINT GENERATED always AS IDENTITY
,Column2    INTEGER
,Column3 INTEGER)
PRIMARY INDEX (IDcolumn);

SELECT * FROM dbc.COLUMNS WHERE columnname = 'idcolumn';

You'll see the datatypes, column order and some additional flags, one of which is IDColType...


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>