Failure 2801 Duplicate Unique Prime Key Error
Contents |
baseUsers turn on suggestions Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. Showing results for Search instead for Did you mean: Teradata : Product Forums failure 2801 duplicate unique prime key error in teradata : Database : duplicate unique primary key error Options Subscribe to RSS insert failed. 2801 duplicate unique prime key error Feed Mark Topic as New Mark Topic as Read Float this Topic to the Top Bookmark Subscribe Printer duplicate unique prime key error in target table Friendly Page sharad Fan Options Mark as New Bookmark Subscribe Subscribe to RSS Feed Get Direct Link Print Email to a Friend Report Inappropriate Content 01-19-2006 03:46 PM 01-19-2006 03:46
Duplicate Unique Key Error Wow
PM duplicate unique primary key error Hi, I had to modify a column's width so i created a temporary table, with modified column width, and populated that temporary table through (insert into temp select * from original_table).Later I dropped the original_table and renamed the temporary table to the original one. The original_table had id as the unique primary index and was duplicate unique prime key error informatica defined as "Id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY". Now I am not able to insert data in this table manually through insert query. It gives me error as "duplicate unique primary key error". Any solutions to rectify this situations. Please Help!!Thanks & Regards, 0 Kudos Reply All forum topics Previous Topic Next Topic 2 REPLIES Fred Teradata Employee Options Mark as New Bookmark Subscribe Subscribe to RSS Feed Get Direct Link Print Email to a Friend Report Inappropriate Content 01-19-2006 11:00 PM 01-19-2006 11:00 PM Re: duplicate unique primary key error GENERATED BY DEFAULT columns are not guaranteed to be unique anyway, but if you're sure that's what you want: create another table but specify that generated values START WITH a value beyond anything already present in the table; INSERT/SELECT the data, drop old, rename again.Since you have to copy the data to a new table anyway, consider whether GENERATED ALWAYS NOCYCLE would be better for your application. (Of course, then you wouldn't use "SELECT *" because you're not allowed to specify a value to insert in
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn duplicate unique prime key error world of warcraft more about Stack Overflow the company Business Learn more about hiring developers or posting
Teradata Odbc Teradata Driver Teradata Database Duplicate Unique Prime Key Error
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community
Duplicate Unique Primary Key Error In Informatica
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Teradata identity column and “Duplicate unique prime key error in http://community.teradata.com/t5/Database/duplicate-unique-primary-key-error/td-p/383 dbname.tablename” up vote 0 down vote favorite I created a table using the below definition for a Teradata identity column: ID INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1 MINVALUE 0 MAXVALUE 100000000 NO CYCLE), ---- UNIQUE PRIMARY INDEX ( ID ) For several months, the ID column has been working properly, automatically generating a unique value for the column. Over the past month, http://stackoverflow.com/questions/11727972/teradata-identity-column-and-duplicate-unique-prime-key-error-in-dbname-tablena however, ELMAH has been intermittently reporting the following exception from our .NET 4.0 ASP.NET app: Teradata.Client.Provider.TdException: [Teradata Database] [2801] Duplicate unique prime key error in DATABASENAME.TABLENAME. I was able to replicate it by opening SQL Assistant and inserting a bunch of records into the table with raw SQL. As expected, most of the time it would insert successfully, but other times it would throw the above exception. It appears that this error is occuring because Teradata is trying to generate a value for this column that it has previously generated. Does anyone have any idea how to get to the bottom of what's happening? At the very least, I'd like some way to debug the issue a bit deeper. unique identity teradata share|improve this question asked Jul 30 '12 at 19:06 oscilatingcretin 2,8301469132 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote I would suggest changing the definition of your identity column to GENERATED ALWAYS to prevent the application or ETL process from supplying a value that could have been used. In fact, it is recommended by Teradata that if you are using your IDENTITY column as part of a UPI that it should be defined as GE
notifications of new posts by email. Join 126 other subscribers Email Address Trending Posts Teradata Date Functions Teradata SQL Assistant - Tips & Settings for better work Teradata Parallel Transporter TPT - Basics , Example and Syntax Teradata SQL COALESCE http://usefulfreetips.com/Teradata-SQL-Tutorial/remove-duplicate-unique-primary-key-error/ statement with Example Teradata Volatile Table with Example Teradata SQL UNION and SQL UNION ALL with example Teradata Date Functions - Advance CREATE STORED PROCEDURE EXAMPLE IN TERADATA I want to learn Teradata. Teradata Recursive Query Syntax with Example Teradata SQL Tutorial Recent DiscussionRaj on Teradata Date FunctionsMano on Teradata Date FunctionsSweta on Teradata SQL Test - 4Raviteja on Teradata SQL Test - 1Kiru on Teradata Parallel Transporter TPT - Basics , Example and Syntax REMOVE duplicate unique DUPLICATE UNIQUE PRIMARY KEY ERROR October 7, 2012 by Raj | One Comment While using SQL JOINS , we sometime may face DUPLICATE PRIMARY KEY ERROR. This error may especially come while tables containing history are included in JOIN conditions. So while using SQL Joins, we must take care of this problem. Let us look into this problem in more detail: Duplicate Unique Primary Key Error in Teradata Suppose we have a table which is maintaining duplicate unique prime history of all the CUSTOMERS. And we do a join with this table with some other table on the basis of CUST_ID (key column in this case) . Since the table is maintaining history of CUSTOMERS, so it will be having multiple entries for same CUST_ID. So if the join condition is on CUST_ID, it will result in one to many mapping and the result set will also have multiple entries for same CUST_ID. Now if the target is having CUST_ID as primary key, it will throw UNIQUE PRIMARY KEY violation error. So how to avoid such situation ? The easiest way of overcoming this issue is to fetch the latest entry of CUST_ID from the history table. So in that case, it will be fetching only one instance of each CUST_ID even if multiple entries exists. Now we will see how we can implement this using the SQL in Teradata. If the table is maintaining history in the table then it must be having a date column which will be useful in maintaining history. So you can put a condition on the date column to fetch only the latest row when multiple exists for same key. Let us see how you can implement this check in Teradata: SELECT CUST_ID , CUST_NAME,CUST_CITY FROM CUSTOMERS QUALIFY ROW_NUMBER() OVER (PARTITION BY CUST_ID ORDER BY DAT_UPD DESC)=1; This