How This code works?
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


How This code works? Expand / Collapse
Author
Message
Posted 12/4/2007 2:42:29 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Post #9945
Posted 12/4/2007 10:06:54 AM
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum 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.


Post #9953
Posted 12/4/2007 11:52:33 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Post #9962
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 3:05am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.047. 7 queries. Compression Disabled.