Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change a key value
Message
 
To
24/09/2008 16:28:25
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01350332
Message ID:
01350352
Views:
28
>>>>>I have a table where the key field is index a candidate index and field a want change is a regular index. I get the message
>>>>>
>>>>>Failed to update table,  Unique index violation
>>>>>
>>>>>The error number is 1884. How do I change the second value, i,e, from a "B" to an"A"?
>>>>
>>>>No, you want to update a field that is involved in Primary or Candidate index :-)
>>>>And that violates the rule.
>>>
>>>I know why I get the message, my question is there a way around the problem,
>>
>>Not if it violates the uniqeness of the key. You would have to make the index a regular index - not primary or candidate.
>
>But then how to I get rid of the original record, is there a way of programatically of temporarily changing the index and then changing it back afterwords.

No,
Even if you change it to regular and then try to make it back candidate or primary you will get an error again.
You could delete the original record, but you should make that index to be filtered index and to ignore deleted records or you should PACK the table before you insert new record (Grrr!)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform