All Forums Database
marius 21 posts Joined 09/05
19 Oct 2006
Support for generating unique sequence numbers

Does Teradata support a database object for generating unique sequence numbers (like Oracle's Create Sequence), if not, any ideas?Thnx

Fred 1096 posts Joined 08/04
20 Oct 2006

Teradata does not have a SEQUENCE object type. Best alternative will depend on what you are doing with the values. For example, do they have to be strictly increasing with no gaps, or just unique? Do they have to be unique for all time or only for the duration of some process (e.g. ETL/ELT)?

Jim Chapman 449 posts Joined 09/04
20 Oct 2006

Teradata provides the standard (SQL:2003) IDENTITY attribute for columns.An identity column has, as a default value, an automatically generated unique number. This can usually serve as a satisfactory alternative to the Oracle-style sequence generator, and it is far simpler to use.

BBR2 96 posts Joined 12/04
22 Oct 2006

I think IDENTITY columns have their own limitations and are not synonymous as sequences. I would recommend you to use ROW_NUMBER identified to generate unique numbers. You could look up for MAX of existing number and start generating the sequence. Vinay

JoeMM-5216 9 posts Joined 11/07
03 Dec 2007

Hi Vijay,Can you explain more about how to use ROW_NUMBER?Regards,JMM

You must sign in to leave a comment.