title: import a DBF file in SQL Server using SQL Script
body: <p>How can I import a <code>.dbf</code> file into SQL Server using a SQL script?</p>
  
  <p>Found answers from this post, but unfortunately none of them work to me :( : </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/19727768/trying-to-import-foxpro-dbf-file-to-sql-server">Trying to Import FoxPro DBF File to SQL Server</a> 
  and</li>
  <li><a href="https://stackoverflow.com/questions/52822/how-to-import-a-dbf-file-in-sql-server">How to import a DBF file in SQL Server</a></li>
  </ul>
  
  <p>When I'm trying this code :</p>
  
  <pre><code>SELECT * 
  INTO [APP_DB]..[BILLHEAD] 
  FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver; SourceDB=D:\DBF; SourceType=DBF', 'SELECT * FROM BILLHEAD')
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)".</p>
  </blockquote>
  
  <p>And also, when trying this :</p>
  
  <pre><code>SELECT * 
  FROM openrowset('VFPOLEDB','D:\DBF\BILLHEAD.dbf';'';
                  '','SELECT * FROM BILLHEAD')
  </code></pre>
  
  <p>I get this error :</p>
  
  <blockquote>
    <p>Msg 7438, Level 16, State 1, Line 1<br>
    The 32-bit OLE DB provider "VFPOLEDB" cannot be loaded in-process on a 64-bit SQL Server.</p>
  </blockquote>
  
  <p>I don't want to download any third party application. That's why I'm trying all the possible solution and I need your help now guys. I'm creating a small application to import <code>.DBF</code> files into SQL Server.</p>
  
  <p>Regards,</p>