All Forums Database
crzyon 2 posts Joined 01/10
06 Feb 2012
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? 

ulrich 816 posts Joined 09/09
06 Feb 2012

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

;

?

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

crzyon 2 posts Joined 01/10
06 Feb 2012

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.

 

ulrich 816 posts Joined 09/09
06 Feb 2012

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.

 

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

You must sign in to leave a comment.