none
Trying to use a stored procedure to import a DBF file

    Question

  • I don't want to use any other tool, I just want to programmatically use vfpoledb to import data from a dbf file. I have downloaded and used the vfpoledb driver in applications but whenever I try to use it in my stored procedure it says vfpoledb is not registered. Here is my code.

    SET
     ANSI_NULLS ON
    
    GO
    SET
     QUOTED_IDENTIFIER ON
    
    GO
    -- =============================================
    
    -- Author:		<Author,,Name>
    
    -- Create date: <Create Date,,>
    
    -- Description:	<Description,,>
    
    -- =============================================
    
    CREATE
     PROCEDURE
     spImportDB
    	-- Add the parameters for the stored procedure here
    
    AS
    
    BEGIN
    
    	-- SET NOCOUNT ON added to prevent extra result sets from
    
    	-- interfering with SELECT statements.
    
    	SET
     NOCOUNT
     ON
    ;
    
        -- Insert statements for procedure here
    
        -- Get the folder that stores the MOM tables
    
    		
    	SELECT
     * into
     MyNewProducts
    	FROM
     OPENROWSET
    ('vfpoledb'
    ,'C:\Users\Adm\Desktop\DBF'
    ,
    	'SELECT * FROM DbfProducts'
    )
    END
    
    GO
    
    and here is the error:

    Msg 7403, Level 16, State 1, Procedure spImportDB, Line 17
    The OLE DB provider "vfpoledb" has not been registered.

    I've also tried using vfpoledb.1 and that didn't work either.
    Any help would be greatly apprciated. This is really making me angry. Also when I go to DTS and import data that way I can use the Microsoft Fox Pro Driver for OleDb without any problems but not when I use the openrowset, so I figure it's something in my syntax or what I'm not passing in to the function. help...thanks
    john.strez
    • Edited by john.strez Wednesday, May 20, 2009 5:36 AM
    Wednesday, May 20, 2009 3:29 AM

Answers

  • Most likely John, there is a problem with the registration as SQL Server sees it.  Perhaps the other applications check different registry keys or SQL Server's entries are damaged?  Follow the advice in Brad's post to see if that helps.  Ultimately, re-installing the package that contains the driver might be the way to go?

    Paul
    • Marked as answer by john.strez Wednesday, May 20, 2009 1:02 PM
    Wednesday, May 20, 2009 7:29 AM

All replies

  • Hey John,

    Are you running 32-bit or 64-bit SQL Server?

    Paul
    Wednesday, May 20, 2009 5:05 AM
  • 32 bit SqlServer Express

    john.strez
    Wednesday, May 20, 2009 5:33 AM
  • You may be missing some parameters.

    I just executed the following successfully:

    select * from openrowset('vfpoledb','c:\cds\data';' ';' ','select * from sysref')

    --Brad
    Wednesday, May 20, 2009 5:41 AM
    Moderator
  • I just tried that and it's still saying vfpoledb not registered. To me it sounds like it's saying I don't have it installed or that I need to register it with sql server somehow. I really don't know. It works if I use DTS or through a connection string in my C# app but not when using the openrowset in a stored procedure. It's really bugging me.
    john.strez
    Wednesday, May 20, 2009 6:10 AM
  • This person apparently had a similar problem... somehow their OLE*.DLL files got unregistered, so they just re-registered them using regsvr32 and all was okay...

    http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/12aad735-4926-486d-b97a-df07d796ecba/
    --Brad
    Wednesday, May 20, 2009 6:14 AM
    Moderator
  • I'm wondering why I would be able to use the driver in every other way through DTS and connectionstrings in my applications but not in my stored procedure?

    john.strez
    Wednesday, May 20, 2009 6:22 AM
  • Most likely John, there is a problem with the registration as SQL Server sees it.  Perhaps the other applications check different registry keys or SQL Server's entries are damaged?  Follow the advice in Brad's post to see if that helps.  Ultimately, re-installing the package that contains the driver might be the way to go?

    Paul
    • Marked as answer by john.strez Wednesday, May 20, 2009 1:02 PM
    Wednesday, May 20, 2009 7:29 AM
  • All answers helped me . Reinstalling worked. Thanks
    john.strez
    Wednesday, May 20, 2009 1:03 PM