Generate Character Sequences

Database
Fan

Generate Character Sequences

Hi,

I have a column char(4) which contains nubmers and characters.  Say ADG0, ADG1, ADG2 and I want to generate sequences for this column.  How can I do that with a character field? 

3 REPLIES
Supporter

Re: Generate Character Sequences

do you mean something like

select 'ADG' !! trim(calendar_date - current_date)

from sys_calendar.calendar

where calendar_date - current_date between 1 and 9

;

?

Fan

Re: Generate Character Sequences

No this column is like an identity column.  There is not date involved in this column.  Basically you have 4 characters that are auto-generated sequentially.  I need to bring that into Teradata and perform that on the database side.

Supporter

Re: Generate Character Sequences

I think a UDF which converts integer to this kind of char will do best.

But I think you would need to code this on your own or pay somebody to do so.