How do we generate surrogate keys in teradata ?
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 do we generate surrogate keys in teradata... Expand / Collapse
Author
Message
Posted 12/27/2007 5:54:49 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 10/8/2009 1:16:14 PM
Posts: 79, Visits: 105
Hi,

How do we generate surrogate keys in teradata, kindly explain with an example?

I know the basic concepts of surrogate keys, what I need is how do we implement it in teradata?

From one of the teradata PDFs, I read that it can be generated with help of Identity columns, can someone provide me the syntax for the same.

Also I would like to know, is there any other method available to generate surrogate keys in teradata?

Regards,
Balamurugan
Post #10126
Posted 12/31/2007 7:49:17 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 8/4/2009 12:24:24 PM
Posts: 144, Visits: 93
Why dont you try CSUM function? That might be simpler.


Regards
Ramakrishna Vedantam
Telecom Technology Excellence Group
Tata Consultancy Services
Website: http://www.tcs.com
Post #10145
Posted 1/7/2008 3:55:28 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/24/2008 5:31:43 AM
Posts: 6, Visits: 38
CREATE TABLE TESTDB.TEST1 (
EMPNO NUMERIC(10) GENERATED ALWAYS AS IDENTITY
(START WITH 1 INCREMENT BY 1),
ENAME VARCHAR(50)
) ;


OR

Use CSUM function
cumulative (or running) sum of a column expression
Post #10173
Posted 1/7/2008 5:08:50 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 10/8/2009 1:16:14 PM
Posts: 79, Visits: 105
Hi Rama,Shakir thanks for your inputs!!

Regards,
Balamurugan
Post #10175
Posted 9/23/2008 3:40:14 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/23/2008 4:22:32 AM
Posts: 11, Visits: 7
beware with identity columns. they will always generate unique values but not sequential. so there would be gaps in numbers.
best approach would be to increment the surrogate key in your transform script which is a standard data warehousing practice and not limited to teradata. there is no teradata equivalent of oracle sequences which is used by OLTP systems to generate their keys mostly.
Post #12982
« 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 10:20am

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.078. 4 queries. Compression Disabled.