Question

Copy to &/or Append from appear to miss records

Asked by: leemarc

Table to copy/append from contains 1,012,897 records (noe are marked deleted)
Resulting table only conains 929,300 records - more than 85000 missing.
If I simply copy the table using windows or DOS, all of the records are there.
I have checked all the data to ensure that there are no non-printable type characters int he data.
I can't for the life of e fifure out th difference.
The original table is a FPW2.6 dbf.  I can open it in VFP and see all the records until I copy the using copy to in vfp and then the resulting table is missing records.  The table has only one memo field. Can any tell me why records can can lost using  the copy/append routine

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-08-11 at 10:07:06ID23638570
Topic

FoxPro Database

Participating Experts
3
Points
0
Comments
35

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Appending Multiple DBF Files
    In my program I have a report that needs the information out of all of the dbf files except for memo fields. Using the SELECT Current APPEND FROM (newfile) And... Scan scatter /append blank / gather / select //// Copy to array aArray SELECT Current append from array ends...
  2. How to export  a *.dbf to an Excel-file INCLUDING memo…
    Hello, how do I export a VFP 6.0 table (dbf) to an Excel-file INCLUDING memo fields? The VFP "copy to ... type xl5" command ignores all memo fields of the table which ist exported. Any idea how to export including all memo-fields, or is there a class/function av...
  3. Append blank...not adding record to dbf until tableupdat…
    I recently took a VFP 6.0 class, where the instructor told the class that the command append blank would not add the blank record until a tableupdate command was issued. In my application, I have an "add account" form, where in the init of the form, I have select d...
  4. Can't import memo fields into Outlook from DBF files
    TeleMagic is a Foxpro app contact manager. There is a memo field with free form text notes. I have the Dbase file with memos. I cannot get the memo field imported into Outlook. I get similar (but not the same) errors in Outlook 97, 2000, and 2002. I have tried - -DBase III ...
  5. append vfp data to access
    i have 2 tables a local vfp table (on a local server) a remote access table both structures are basically the same. to move the data to access i am using i have tried 2 different approaches number 1 gives no errors but the results did not save to the access table number 2 re...
  6. VFP table memo fields corrupt after power failure
    Memo field acting wildly after power failure. How do you get them "back in sync" with the table?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: tusharkanvindePosted on 2008-08-11 at 10:53:10ID: 22206593

It could be a corrupt index. give DELETE TAG ALL and then try.

 

by: leemarcPosted on 2008-08-11 at 11:25:01ID: 22206849

took your advice and it did nothing different still missing records.  I have even tried running thru the database to try and figure which ones are missing and cannot seem to discerene them - it just indicates there is nothing missing

 

by: CaptainCyrilPosted on 2008-08-11 at 11:38:11ID: 22206967

It could be corrupted index or try SET DELETED OFF.

 

by: jrbbldrPosted on 2008-08-11 at 11:39:00ID: 22206979

After building the necessary indicies, set up a relation with the original table as the Parent and the COPY result table as the Child.

Then do a Browse on the Parent table for Empty(Child.something) to see the records which did not get copied.
Once you can identify the specific records which did not get copied, then you should be able to identify the problem.

Worst case, you can create a 2nd small table of only those non-copied records and then attempt to append them.

Good Luck

 

by: leemarcPosted on 2008-08-11 at 11:40:49ID: 22206999

working on that as we speak - there are ore that a million records and I am trying to this programattically
but not having a lot of luck

 

by: leemarcPosted on 2008-08-11 at 12:03:46ID: 22207203

attching a code snippet as a sort of guide as to what I aha tried

CLEA
CLOSE DATABASES ALL
USE w:\temp\sbt\arinvt01 ALIAS invttemp IN 0   && 1012891 records
USE w:\sbt\arinvt01 ORDER ITEM ALIAS invtnew IN 0  && reuslt table 929399 record
 
=AFIELDS(arfldlist,"invttemp")
CREATE CURSOR sqlMissingINVTParts FROM ARRAY arfldlist
 
? RECCOUNT("invttemp"), RECCOUNT("invtnew")
* above results in 1012891 and 929399
 
SCAN   && invttemp
	@ 10,1 say "invttemp Record: " + STR(RECNO("invttemp"))
	csearch = ALLTRIM(invttemp.item)
 
	IF !SEEK(cSearch,"invtnew")
                  * this never ever trips and I cannot figure why not
		SCATTER NAME missingrec
		INSERT INTO sqlMissingINVTParts FROM NAME missingrec
		@ 12,1 say "Missing Record: " + STR(RECNO("sqlMissingINVTParts"))
	ELSE
		@ 11,1 say "Number Found: " + STR(fndktr)
		fndktr = fndktr + 1
	ENDIF
 
 
	endif
ENDSCAN
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:

Select allOpen in new window

 

by: tusharkanvindePosted on 2008-08-11 at 12:55:11ID: 22207611

Keep SET EXACT ON and don't do ALLTRIM()

 

by: leemarcPosted on 2008-08-11 at 13:03:00ID: 22207668

That does not work either.
Set deleted is off - besides there are no deleted records
Set exact if on and alltrim has been removed.
The program still has no missing records noted. Allthe records in the 100+ million records were found int he table with 930000+ records.  Duplicates are not an issue, there are only six of them otherwise all the item codes are unique. There are no constraints, no triggers, no nothing. One index tag on the file that is being searched [key() = item]

 

by: jrbbldrPosted on 2008-08-11 at 13:45:56ID: 22208046

CLEAR
CLOSE DATABASES ALL

USE w:\temp\sbt\arinvt01 ALIAS invttemp IN 0  EXCL    && 1012891 records
USE w:\sbt\arinvt01 ALIAS invtnew IN 0  EXCL   && result table 929399 record

SELECT InvtNew
INDEX ON Item TAG Item  && Re-build Index

SELECT InvtTemp
SET RELATION TO Item INTO InvtNew
COPY TO c:\temp\temp FOR EMPTY(InvtNew.Item)   && Make copy of not-copied records

* --- Analyze Missing Records ---
USE c:\temp\temp IN 0 EXCL
SELECT Temp
INDEX ON Item TAG Item
<Do Whatever>

Good Luck

 

by: leemarcPosted on 2008-08-12 at 05:28:04ID: 22212233

tried your suggestion and there was nothing in the resulting temp dbf,
now you can see my pain - any ideas will be tried

 

by: CaptainCyrilPosted on 2008-08-12 at 05:36:30ID: 22212323

can you open the original table in vfp and do this:

set talk on
count

and give us the record count please?

 

by: CaptainCyrilPosted on 2008-08-12 at 05:38:27ID: 22212345

Could it be the memo file is damaged? Can you copy the table to another in FPW26 and see if there are missing records?

 

by: jrbbldrPosted on 2008-08-12 at 06:25:52ID: 22212815

Assuming that the Relation is set up and working correctly (you should do a BROWSE FOR !EMPTY(item) - just to check), then If there is nothing in the Temp.dbf, then it means that for every Item in the original table, there is a matching record in the new table.

That would imply that the accuracy of RECCOUNT() for the original table might be in doubt - whether due to file corruption or other causes.

Good Luck

 

by: leemarcPosted on 2008-08-18 at 04:59:23ID: 22250959

jrbbldr: using your technique there is still nothin missing.
what things can cause RECCOUNT to be inaccurate.

 

by: tusharkanvindePosted on 2008-08-18 at 06:17:53ID: 22251517

If reccount is inaccurate, the file is not opened. Trying to use it give a Not a Database File or Not a Table error. But Reccount includes deleted records.

 

by: leemarcPosted on 2008-08-18 at 06:19:53ID: 22251530

the file is opened, there is no error at all -

 

by: tusharkanvindePosted on 2008-08-18 at 06:37:52ID: 22251679

In that case, reccount() is giving the correct result. Either the index is corrupt or you have deleted records.

If you give list structure, you will get the total record length

take the size of the file
subtract 32 from it
subtract 32*n from that. n is the number of fields

divide the number by the record length to get the record count

 

by: leemarcPosted on 2008-08-18 at 06:53:43ID: 22251799

the size of trhe file from where, DOS, windows or vfp

 

by: CaptainCyrilPosted on 2008-08-18 at 06:57:22ID: 22251827

Type DISPLAY STRUCTURE in the Command Window to get this info.

Total is the size of the record.

 

by: tusharkanvindePosted on 2008-08-18 at 07:18:15ID: 22252049

DOS, windows and  vfp should give you the same file size.

SET COMPATIBLE on
?FSIZE(YourDbfFileName)

Should give you the file size in VFP.

 

by: leemarcPosted on 2008-08-18 at 11:15:28ID: 22254210

math you all suggest - works except I still get the same results. ONe table has over a milion records wil  the resulting table after copy or append only has 990,000 plu records

 

by: tusharkanvindePosted on 2008-08-18 at 12:57:03ID: 22255042

How do you know that there are no deleted records.

 

by: CaptainCyrilPosted on 2008-08-18 at 12:58:18ID: 22255049

It seems to me one of two things:

1) Deleted records exist
2) Corrupted index or table

 

by: leemarcPosted on 2008-08-18 at 13:04:17ID: 22255081

there are no deleted records according to coutn for deleted() [and yes deleted is set oto off)
the indexes have been rebuilt.

Could there be and differnce caused by the difference between a FPW26 table and VFP 9 table.other than the size of the memo fields [10] in fwp and 4 in vfp]
Note they are both free standign dbf's not dbc.

 

by: CaptainCyrilPosted on 2008-08-18 at 13:06:53ID: 22255096

Did you test the copy on both version of FoxPro?

It could be the original database is corrupt. Have you tried creating a new table with similar structure and append from the original table?

 

by: leemarcPosted on 2008-08-18 at 13:09:52ID: 22255118

Have not tried that yet. difficult since it is live data and the copy would bring the newtork to a screechingh if done during the day.  Need to wait till the weekend

 

by: CaptainCyrilPosted on 2008-08-18 at 13:13:28ID: 22255150

I think the data table is corrupt since you have set deleted off and rebuilt in indeces.

I handle millions of records in fpw26 and never had problems either on server or on laptop.

 

by: leemarcPosted on 2008-09-02 at 05:00:43ID: 22366381

problem is still not solved. Have no idea how to find the corruption you all memtion, there has to be a better way than to roll thru each record one my one by hand field by field to find it. Any ideas welcome

 

by: tusharkanvindePosted on 2008-09-02 at 06:13:05ID: 22366913

CaptainCyril had asked you to do
SET TALK ON
SET DELETED OFF
COUNT

and post the result.

Another thing you can do is

USE InvtNew
INDEX ON Item TAG Item  && Re-build Index
lnDupl=0
lnRec=0
lcLastItem='ZZZZZ'
SCAN
   IF  lcLastItem=Item
      lnDupl=lnDupl+1
   ELSE
      lcLastItem=Item
      lnRec=lnRec+1
   ENDIF
ENDSCAN
?lnRec,lnDupl
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:

Select allOpen in new window

 

by: leemarcPosted on 2008-09-09 at 04:56:31ID: 22426392

still wating for a successfull answer - so far unable to figure why the difference in record numbers
have tried the last item sent by captaincyril and the same thing occurs.  Want to start with a fresh copy but have to wait till weekend so I don't drag the whole company's netwrok down at once during the copy.

 

by: CaptainCyrilPosted on 2008-09-09 at 05:28:04ID: 22426662

You can zip the file on the server by remote access and then copy it over the network. This way you don't have to hog the network. At least 90% compression is achievable.

 

by: CaptainCyrilPosted on 2008-09-09 at 05:28:26ID: 22426666

I average 92% on large databases.

 

by: leemarcPosted on 2008-09-09 at 05:33:07ID: 22426710

good idea, however, in my case for the time being, on database is one server in another location and need bring it to my side.  So far I am not permitted access to writing a file directly to the c drive of the server and then unzip it - but I will check in this asap

 

by: leemarcPosted on 2008-09-09 at 05:34:43ID: 22426725

by the way I do zip it when I copy the inventory from there to here, it also takes a long toime to zip them up - so still need to weait for non work time

 

by: leemarcPosted on 2009-01-21 at 05:09:09ID: 23429170

Sorry for my long absence - have not been well for a while.  Back to work now.
I finally determined that it has everything to do with records that ar marked for deletion. Both append and copy to seem to igrnoe these records.  This issue is solved. Please

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...