Link to home
Start Free TrialLog in
Avatar of gyuan
gyuan

asked on

how to import data from .dbf file to MS SQL server?

I have a file extended with .dbf and I want to transfer data from the file to MS SQL server 2000. Can you give me some idea how to do it? Thanks.
Avatar of ispaleny
ispaleny
Flag of Czechia image

1. Run dtswiz.exe and click next
2. Select dBase IV from combo, fill file name
3. Click Next
4. Fill SQLServer logon information
5. Select database
6. And so on
Avatar of gyuan
gyuan

ASKER

Where can I get dtswiz.exe ? Thanks.
It is in MSSQL tools installation (Query Analyzer,...)
In Programs it is named "Import and Export Data".

Try Start - Run - type "dtswiz.exe" - click on OK
Be very careful in thinking the dBASE IV choice will work.  Depending on where that .dbf came from, it could easily be a table (.dbf) from the MS Visual FoxPro data environment that might just be different enough where a dBASE IV interface fails to load it as you would expect.  Just a note to let you know why it may not do what you want on the first try...
Avatar of gyuan

ASKER

I got the following error:

Error Source: Microsoft JET Database Engine
Error Description: External table is not in the expected format.
Context: Error calling OpenRowset on the provider.
I am convinced you just found out it isn't a dBASE IV .dbf file.

Not being an avid MS SQL Server afficionado, I'm not sure what mechanism Data Transformation Services via the dtswiz.exe uses to grab that data.  Does it use available connectivity drivers in the way of ODBC drivers?  If so, you may in fact need the MS VFP ODBC driver to get to that .dbf file.  Since that driver hasn't been part of the MDAC package for quite a while now, you'll need to d/l it and install it separately, if it is in fact what DTS needs.

Visual FoxPro ODBC Driver
http://msdn.microsoft.com/vfoxpro/downloads/updates/odbc/default.aspx
Avatar of gyuan

ASKER

Thank your for your information. I visited that page. Since the file VFPODBC.DLL exists in my system, I think the ODBC driver is there. The hard thing is that I only have the database files extended with .dbf and I was told that those files are dBase files. I even do not know what the version is. I really can not find the way to retrive data from the files.
ASKER CERTIFIED SOLUTION
Avatar of CarlWarner
CarlWarner
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gyuan

ASKER

Sorry, based on the information submitted by the users, I still can not solve the problem. Any further help will be apprreciated.
Export the table to a CSV.

From within Foxpro, select the table and type

"copy to filename csv"

Then from the enterprise manager, import there and select the last option under source - text file. And you should be set.
And if there are any memo fields involved, the CSV export will lose all of that.
Ok, fine. You can also create an actual database in foxpro, attach the loose table to it, and then import it using hte dtwiz. I have something like that running righ tnow.