Solved

Update Query fails due to Key Violations.

Posted on 2002-05-07
6
838 Views
Last Modified: 2008-03-03
Im am trying to perform an update query on a table that contains 2 Primary Keys but when i try and call the query i get the following message:

Cant update all the records in the Update Query.

Tivoli Fixes didnt update 0 field(s) due to a type conversion failure, 20 record(s) due to key violations, 0 record(s) due to lock violations and 0 record(s) due to validation rule violations.

i looked in the help - and it suggests that within the code i can use the Primary Proerty and change the primary keys to non-primary while i perform the update query and then set them back. Please could you help me  on how i would do this?
0
Comment
Question by:Sheets
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 50 total points
ID: 6994064
Normally you won't use an update query to change the primekey (or keys) of a table.
To change those you would use an Append (INSERT INTO) query followed by a DELETE.
A primekey identifies a row. Changing it implies effectively adding a new one and removing the old one.
Clear sofar ?

What is it exactly that you're trying to achieve?

Ni';o)
0
 
LVL 58
ID: 6994125
Key violations are the result of one of two things:

1. Duplicate key on an index that doesn't allow duplicates (i.e. the primary key).

2. You have a relationship (M-O) with another table and their is no corresponding parent record in that table.

Jim.
0
 

Author Comment

by:Sheets
ID: 6994160
Thanks for the replies but youre right - i didnt need to do an update query!! I was getting abit confused. I actually wanted to insert a new record - but its all sorted and it all works. thanks.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 54

Expert Comment

by:nico5038
ID: 6994187
Glad I could help ;-)

Nic;o)
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7215750

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
 - Answered by: nico5038  
Please leave any comments here within the
next seven days.

Nic;o)
0
 

Expert Comment

by:Jgould
ID: 7240028
Question has been force accepted as per recommendation

JGould-EE Moderator
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question