|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 4/4/2008 4:35:01 AM
Posts: 6,
Visits: 25
|
|
Hi folks,
This code is used for finding the start and end date of the partition, constrainttext is a column in a DBC veiw table. let me know why should they added 13 and -37
select
substring
(
constrainttext
FROM index(constrainttext,'BETWEEN DATE') +13
FOR 12
)
, substring
(
constrainttext
FROM index(constrainttext,'NO RANGE') -37
FOR 12
)
from dbc.indexconstraints
where databasename = 'travel'
and tablename = 'branch_item'
Result:
returns the overall partition from and to dates
'2003-08-03' '2005-12-31'
Thanks
Vedamurthy
Vedamurthy
|
|
|
|
|
Forum Guru
      
Group: Forum Members
Last Login: 6/19/2008 3:13:51 PM
Posts: 50,
Visits: 219
|
|
First it is finding the starting position of substring 'BETWEEN DATE' using index function then adding 13 to get the starting position of the first Date range , then reading 12 characters from there to get the DATE value.
Same technique for the other column.
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 4/4/2008 4:35:01 AM
Posts: 6,
Visits: 25
|
|
Thanks for your reply
Many Thanks
Vedamurthy
Vedamurthy
|
|
|
|