Hi Elmer,
I ran this on one of my data sets and I got the same problem. I turned off Fetch Data in Background in the ODBC driver, and that seemed to eliminate the duplicates. You may be able to do this in code, but I'm not sure since I don't use SPT. The table I had a problem with copied 372,000 records. Unfortunately, the source table is 382,000 records. This might just be a problem with my data, but you should probably double-check your record counts.
BTW, it's good to see some of my code is in the new system. Of course, it is only the first six letters of the DBC name, but I'll take what I can get. <g> Seriously though, how's life at ARI these days? Are John and Matt still working there?
>I wrote a procedure today to copy data from an ODBC database to another empty VFP database with the same tables and structures to get a copy of data from SQL server to a VFP database for testing. Basically, I created a VFP database with empty tables for the copy and used SPT to "SELECT *" from each table in the source database into a cursor, then append from the cursor into the matching table in the copy database. Not an elegant solution but a very simple one (or so I thought).
>
>This worked well when copying data from a SQL Server database to a VFP database, but when I tested it using a VFP source database, on several tables, seemingly at random, the SPT query gets the correct record count from the source table, but when I append from the cursor, I get a "Uniqueness of primary key violation" error and the append fails. I have checked it out and the source VFP table does not have duplicate records, but the "select *" SPT cursor does. I have validated the database and recreated all indexes. What is happening is that the SPT cursor is duplicating several records in the result set when I "select * " from the source table using SPT. It does not happen on the same table or same records when running the program over and over.
>
>I created a dbc with remote views that "Select *" from the source and run the same procedure using the RV's and it gets all records, with no error, every time. There are about 63 tables in the database ranging in size from a few records to over 400,000 records. All tables have primary keys and do not have duplicate records.
>
>This concerns me as I use SPT all the time to get cursors for reporting (though not using Select *) but I am now concerned that I may not be getting correct results. I am using VFP 6 SP5.
>
>I have created a couple of test programs with data that will demonstrate this very strange behavior. With the source database it is pretty large even zipped (41 MB) but if anyone is interested in checking it out, I have a FTP site where you can download it. Let me know and I will set it up for download.
>