locked
convert DBF to RRS feed

  • Question

  • Hi
    I'm going to convert DBF to sql.
    It works good for some dbf files but for another returns error for linked server(null)
    the code i s:

    SELECT

     

    * into

    test_1

    FROM

     

     

    OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;SourceDB=d:\\;SourceType=DBF','SELECT * FROM Kar8802'.dbf)

    Sunday, July 26, 2009 9:56 AM

Answers

  • Hi,

    If NULL values return error when importing data from FoxPro linked server to SQL Server, you could replace NULL with the specified replacement value by using the following syntax:
    OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;SourceDB=d:\\;SourceType=DBF','SELECT IIF(ISNULL(field_name),’null’,field_name) as new_name FROM Kar8802'.dbf)

    If there are any more questions, please let me know.

    Thanks.


    ***Xiao Min Tan***Microsoft Online Community***
    Tuesday, July 28, 2009 2:38 AM

All replies

  • You can use Access to import dbf, then use SQL server to import from Access.
    Sunday, July 26, 2009 1:36 PM
  • Hi,

    If NULL values return error when importing data from FoxPro linked server to SQL Server, you could replace NULL with the specified replacement value by using the following syntax:
    OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;SourceDB=d:\\;SourceType=DBF','SELECT IIF(ISNULL(field_name),’null’,field_name) as new_name FROM Kar8802'.dbf)

    If there are any more questions, please let me know.

    Thanks.


    ***Xiao Min Tan***Microsoft Online Community***
    Tuesday, July 28, 2009 2:38 AM