Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a DBF file in SQL Server

How can you import a foxpro DBF file in SQL Server?

like image 845
Pop Catalin Avatar asked Sep 09 '08 20:09

Pop Catalin


People also ask

How do I import a DBF file?

Importing the DBF fileOpen Access, select the Create New Database Using Blank Database option. Import BLANK. DBF by selecting the File, Get External Data option. Then choose Import.

How do I import a DBF file into SQL Server 2008?

To import DBF files, first use Microsoft Access or Microsoft Excel to import the data from DBF files into an Access database or Excel spreadsheets. Then, use the SQL Server Import and Export Wizard to import the Access database or Excel spreadsheets that contain the data from the DBF files.


2 Answers

Use a linked server or use openrowset, example

SELECT * into SomeTable
FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;
SourceDB=\\SomeServer\SomePath\;
SourceType=DBF',
'SELECT * FROM SomeDBF')
like image 66
SQLMenace Avatar answered Sep 18 '22 12:09

SQLMenace


I was able to use the answer from jnovation but since there was something wrong with my fields, I simply selected specific fields instead of all, like:

select * into CERTDATA
from  openrowset('VFPOLEDB','C:\SomePath\CERTDATA.DBF';'';
    '','SELECT ACTUAL, CERTID,  FROM CERTDATA')

Very exciting to finally have a workable answer thanks to everyone here!

like image 33
mark d Avatar answered Sep 18 '22 12:09

mark d