Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Attempting to Import Census Date into Fox Table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00832945
Message ID:
00832995
Vues:
20
>I have been attempting to import recently released 2000 Census data (http://ftp2.census.gov/census_2000/datasets/PUMS/FivePercent/) into a Fox table. There seems to be no utility for importing text data in VFP 6 or 7. I have managed to import some of the smaller states into Access and export to a dBase IV file. However, Access seems to choke on the larger files. For example, the California data is in a text file that is in excess of 600MB and contains in excess of 3,000,000 records. Each record contains 165 fixed width fields, is 317 bytes wide, and has a funky End of Record delimiter. Access seems to choke on the size of the California data, whereas, it seems to handle files of < 500,000 records quite easily. My puter has 1GB of RAM and plenty of free hard drive to page. Any ideas as to how I might import this into Fox or Access or any other program so that I can ultimately get it into Fox? I have tried importing to SQL Server 2000. However, I can't get it to recognize the EOR
>delimiter (Access does recognize the delimiter) and give me the proper record length.
>
>Any ideas??
>TIA
>Jim

Jim,

Along with the other comments I would suggest the following

Create a cursor, read the data line by line and feed the cursor.

As to the End-Of-Record mark, this piece of code can help (can be modified to use only one fseek() if necessary)
*---------------------------------------------------------------------------
&& RecordSeparator can be any sequence of chars
function	__fgets(fd, maxBytes, RecordSeparator)
	if( empty(RecordSeparator) )
		return	fgets(fd, maxbytes)
	endif
	
	local offset, buf, n
	
	offset = fseek(fd, 0, 1)
	buf = fread(fd, maxBytes)
	n = at(RecordSeparator, buf)
		
	if( n == 0 )
		return buf
	endif
	=fseek(fd, offset + n + len(RecordSeparator) - 1, 0)
	return	left(buf, n-1)
endfunc
*---------------------------------------------------------------------------
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform