?
Solved

Update Query fails due to Key Violations.

Posted on 2002-05-07
6
Medium Priority
?
839 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 200 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

771 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