Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to move data into a SQL-Server database?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00540114
Message ID:
00540223
Vues:
25
This message has been marked as a message which has helped to the initial question of the thread.
Hi Thom,
If you really want to get down and dirty, check out this link (http://msdn.microsoft.com/library/en-us/oledb/htm/oledbabout_the_ole_db_documentation.asp). You would need to implement your connectivity via the OLEDB provider for SQL Server. Of course, you could always use ADO as George suggested because it wraps this functionality for you already into a COM interface.

BTW, BCP is a command line utility used to send data into SQL Server very rapidly.

You might also want to check out the BULK INSERT command, instroduced (I believe) in SS7, in the books on-line (BOL). You can manipulate the ASCII file or create a new one and then have SS process the file for you with this command.

HTH.

>To all who replied, Thanks for the response.
>
>>>Besides BCP that Vlad mentioned, you could use Data Transformation Services (DTS) that come with SQL Server to import data. In general BCP is more efficient, but DTS is easier to use...depending on your scenario.
>
>What is BCP? I've worked with DTS.
>
>
>>>You could also write your own VFP program that reads your flat file and sends SQL Statements (SQL-pass through) to insert your records.
>
>This is closer to what I had in mind.
>
>What I'm asking is:
>
>For example; with xBase files, you can open a flat ascii file with C, open an xBase table (also in C, with appropriate libararies), parse out pieces of each line, insert a new record in the table using the parsed components of the line from the flat ascii file.
>
>Pseudo code.
>
Open VFP data table
>
>Open ascii source file
>
>DO WHILE NOT FEOF()
>   m.lcLine = FGet()
>   IF NOT EMPTY(m.lcLine)
>      Parse m.lcLine into components (i.e. array la_RawData)
>      INSERT INTO <VFP table> FROM ARRAY la_RawData
>   ENDIF
>ENDDO
>
>
>Is it possible to do something similar with SQL-Server:
>1) Open a flat ascii file with C.
>2) Open a SQL-Server database/table.
>3) Parse out pieces of a line in the ascii file.
>4) Insert a new record in the SQL-Server database/table... directly from the C program.
>
>Regards,
>Thom C.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform