Find out the oldest (first) partition of a table

Database
Teradata Employee

Find out the oldest (first) partition of a table

HiI need to find out wich is the first partition of a table with or without data.

If i do min(partition) it only works as long as the partition has data. 

Does anybody knows how to get the date of the first partition?

I even tought of doing something like:

Show table xx into :var

then  substtring(var from "after the between keyword" ...)

but dont know how to do the "Show table xx into :var" part.

So any help, advice and suggestions is welcome.

Thanks.

Tags (1)
1 REPLY
Teradata Employee

Re: Find out the oldest (first) partition of a table

Found it!!

constraintText in dbc.indexConstraints with constraintType = ‘Q’ (PPI)

SEL CAST ((TRIM( SUBSTRING(constrainttext FROM (INDEX(constrainttext,'''')+1)  FOR 10))) AS DATE)

FROM dbc.indexconstraints

WHERE databasename = database

AND tablename = table

AND constrainttype = 'Q'