Determine if a field value is a sequence

Database
New Member

Determine if a field value is a sequence

Hi,

 

I'd like to determine if an actual field value is a sequence of numbers (or letters if possible) or if all characters are the same. Working with Teradata Studio 15.0. I can convert the VARCHAR field to INTEGER to see if I can perform a mathematical operation to determine if it is a sequence or not but am not sure how to do this.

 

End Result:

COL_A    IS_SEQ_TAG

123456       Y

987654       Y

197432       N

111111       Y

999999       Y

 

Thank you!

 

2 REPLIES
Enthusiast

Re: Determine if a field value is a sequence

Are there any other kind of sequences than what you have listed? (fibonacci series, factors, all kinds of other thing).

If the answers is yes, I think it could be complicated (Type of number, int, smallint, bigint)?.

Can you please let me know your end goal? 

 

I read somewhere "Finding numbers from a formula is a science. But finding a formula from numbers is an art."

I my view, SQL that address your question will be probably annoy your friend DBA (depending on size of the table).  

 

Junior Contributor

Re: Determine if a field value is a sequence

Looks like some password checking routine :-)

 

This seems to be a perfect task for implementing a C-UDF.