Problems reading .dbf file

  • Hi All

    I am having a problem reading data from a .dbf file. This file is created by a third party app and I need to import the data into SQL server 2000. Previously I could do this but we migrated to a new hardware platform and now it wont work. We were running SQL server 2000 on win 2000 server, we now run SQL server 2000 on win 2003 server but the stored procedure code is the same. The code I use is shown below:

    SET @sSQL = @sSQL + 'FROM OpenDataSource'

    SET @sSQL = @sSQL + '( ''Microsoft.Jet.OLEDB.4.0'''

    SET @sSQL = @sSQL + ', ''Data Source=' + @attachFolder + ';User ID=Admin;Password=;Extended properties="dBase IV"'''

    SET @sSQL = @sSQL + ')...[' + @attachFileNameWithoutFolderOrExtension + ']'

    and the full path to the file is passed in to the stored procedure.

    When I run this code I get the error:

    Server: Msg 7399, Level 16, State 1, Line 1

    [Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.

    [OLE/DB provider returned message: Index not found.]

    OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBSchemaRowset::GetRowset returned 0x80004005: ].

    This file does not require an index file. I tried opening the file in access and I get a dialog asking for the location of an index file as well. Does anyone know what is going on here or how to tell the jet engine to not use an index file or is ther another way of opening the file (it open fine if I use excel).

    Any help would be really appreciated.

  • I assume that it's a dBase IV format file and not actually dBase III, V or FoxPro?

    Have you tried creating a linked server and using OpenQuery instead of OpenDatasource - there are some settings you can use with the linked server setup such as collation compatible, etc that might influence things?

    I had trouble with FoxPro files which was solved by obtaining the latest OLEDB driver for FoxPro and connecting using the OLEDB driver. I don't have much experience with the JET driver. You could also try an ODBC driver?

  • Hi Ian

    It is a dBase IV file yes. When I tried to create a linked server I got an error message "IDBInitialize::Initialize returned 0x80004005".

    I have similar results with an ODBC driver as well.

    Thanks for the reply though.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply