All Forums Database
29 Aug 2011
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.

 

30 Aug 2011

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'

You must sign in to leave a comment.