Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating SQL Server table
Message
De
10/03/2005 03:44:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
MS SQL Server
Divers
Thread ID:
00994024
Message ID:
00994325
Vues:
32
>>Jerry,
>>The only way to get that many records into MySQL is use use the LOAD DATA INFILE command. It was taking 4 hours to do a data covert and the time went to 2 Minites!!! when I used this. Make sure the vfp Text file is on the same drive as the MySQL database or MySQL will not allow the import. Be sure to use this syntax exactly as you see it.
>>
>>* mVFPTxtFile is the text file that VFP creates.
>>* mSQLTxtFile is what MySQL imports.  Remeber that MySQL expects Forward
>>* Slashes and not Back Slashes in the path.  They both point to the same file.
>>
>>copy to (mVFPTxtFile) deli with "" with tab
>>
>>* Run the command to import into MySQL
>>mCommand = "LOAD DATA INFILE '"+ mSQLTxtFile +"' INTO TABLE " ;
>>+ mDbfFile ;
>>+ [ FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n' ;]
>>=SqlExec(mHandle, mCommand)
>>*
>>
>
>
>Will the above code work with SQL Server? I've got a 7 million row table that gets totally overwritten once each month and I've just started updating via the sqlexecmanager. I had even thought about the batch update dos tool,but thought I'd see what everyone else is doing on fairly large tables.

No it wouldn't. However corresponding commands exist which is also used by bcp utility. Search for messages containing "SQL server" and "bulk insert".
Update: For bulk insert check Thread #886406
John since you'd do it each month could you try both 'bulk insert' one month and openrowset() another month with timings (include time it takes to copy to an ASCII file).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform