Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Chris J
  Where is Chris J?
 
 United Kingdom
 Chris J
 Tags
Subject: RE: "Uniqueness violated" on SYS(2015)
Thread ID: 248724 Message ID: 248954 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Friday, December 25, 2009 6:35:13 PM         
   


> I have a routine that looks (roughly) like this:
>
>
SELECT a
> SCAN
> 
>     SCATTER NAME o BLANK
>     SELECT b
>     && assign various values to o based on fields in a
>     o.rec_id = SYS(2015)
> 
>     IF NOT ISNULL(o.importantfield)
>         APPEND BLANK
>         GATHER NAME o
>     ENDIF
>     SELECT a
> ENDSCAN

>
> After running through a few hundred records, I get a "uniqueness violated" error. I check the index reported, and it is a candidate key index on a single field - rec_id, which for every record in the table contains a value obtained from SYS(2015).
>
> Thoughts?

If you use an autoincrementing field, or a newid() type generated unique value, you can just change your code to:
GATHER NAME o FIELDS EXCEPT rec_id 

-Anders

ENTIRE THREAD

"Uniqueness violated" on SYS(2015) Posted by Chris J @ 12/22/2009 5:15:18 PM
RE: "Uniqueness violated" on SYS(2015) Posted by Borislav Borissov @ 12/22/2009 5:37:31 PM
RE: "Uniqueness violated" on SYS(2015) Posted by Chris J @ 12/29/2009 11:44:45 AM
RE: "Uniqueness violated" on SYS(2015) Posted by Anders Altberg @ 12/29/2009 3:57:23 PM
RE: "Uniqueness violated" on SYS(2015) Posted by Ciprian Zaharia @ 12/22/2009 8:37:07 PM
RE: "Uniqueness violated" on SYS(2015) Posted by Jun Tangunan @ 12/23/2009 1:15:49 AM
RE: "Uniqueness violated" on SYS(2015) Posted by Anatoliy Mogylevets @ 12/23/2009 5:39:50 PM
RE: "Uniqueness violated" on SYS(2015) Posted by Anders Altberg @ 12/25/2009 6:35:13 PM