Resolved DBF Files To Sql

kwhelchel

Well-known member
Joined
Feb 28, 2020
Messages
53
Programming Experience
Beginner
IS there anyone familiar with migrating DBF files to SQL? I have an application that is going to dump data to a DBF file then I need to get it into SQL for reporting on the data.

Thanks
 
If it's a one time operation, you could manually import into Access or Excel and then upload from there to SQL. If it's going to be something that you do regularly, then if memory serves, there should be an ODBC or OLEDB driver available from Microsoft that can read .DBF files.
 
You could do something like the below which will require you to use the foxpro driver. Syntax may not be up to scratch, but I'm sure you could work it out. Try :

C#:
SELECT * into Yourtable
FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual foxpro driver here;
SourceDB =\Your server path here;
            SourceType = DBF',
'SELECT * FROM YourDBF')

Perhaps this might help you. Fox pro reads these DB file types. So you can find the driver on there too : Visual FoxPro Downloads
 
this is what I have done
did install the ole db provider for foxpro
ran this

select * into dbf
from openrowset('MSDASQL','C:\rcs\ORDERS.DBF';'';
'','SELECT * FROM ORDERS')

and get this at this time

OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)".

keith
 
This error is either one of four possibilities :
  1. Your connection string is wrong
  2. You don't have full permissions to the path
  3. You haven't specified the necessary information for the linked server
  4. You have a conflict between 32bit and 64bit drivers
Things to try :
 
Back
Top Bottom