Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: Chris J
  Where is Chris J?
 
 United Kingdom
 Chris J
 Tags
Subject: RE: "Uniqueness violated" on SYS(2015)
Thread ID: 248724 Message ID: 248727 # Views: 4 # Ratings: 3
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, December 22, 2009 5:37:31 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?

There is no guarantee that SYS(2015) will return unique value, esp. when your application work on several computers.
That is why I suggested you to use Integer AUTOINC or GUID.

-----------------
Borislav Borissov

Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.

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