|
|
Archives of the TeradataForum
Message Posted: Fri, 09 Nov 2007 @ 11:12:22 GMT
Subj: | | Re: Looking up ranges of RANGE_N partitioned tables |
|
From: | | Diane Wilson |
Hi guys,
I cobbled together this a while ago - may need a bit of tweeking depending on your PPI intervals
sel
databasename as databasename
,tablename as tablename
,constrainttext
,POSITION ('20' IN constrainttext) as start_from_pos
,POSITION ('MONTH ))' IN constrainttext) as find_from_pos1
,POSITION ('WEEK ))' IN constrainttext) as find_from_pos2
,POSITION ('DAY ))' IN constrainttext) as find_from_pos3
,POSITION ('NO RANGE))' IN constrainttext) as find_from_pos4
,case when find_from_pos1 > 0 then find_from_pos1 - 30
when find_from_pos2 > 0 then find_from_pos2 - 30
when find_from_pos3 > 0 then find_from_pos3 - 30
when find_from_pos4 > 0 then find_from_pos4 - 39
end as start_to_pos
,substring (constrainttext, start_from_pos, 10) as partition_from_date
,substring (constrainttext, start_to_pos, 10) as partition_to_date
from dbc.indexconstraints
Regards
Di
| |