title: Bulk Insert, Invalid Object Error (table name), Excel VBA to SQL Server
body: <p>I am trying to bulk load from a CSV file to an SQL Server (both Excel and SQL Server are sitting on my laptop).  I am doing this via Excel VBA using the "bulk insert" statement.  I keep getting a run-time error of invalid object name for my table.  </p>
  
  <ul>
  <li>I have tested the SQL in studio management and it works fine</li>
  <li>The table name is definitely correct</li>
  <li>I have tested using the different file formats and I get same error</li>
  <li>"insert into..." statement works fine from Excel VBA just not the "BULK INSERT"</li>
  </ul>
  
  <pre class="lang-vb prettyprint-override"><code>connServer.Open "Provider=SQLOLEDB;Data Source=" &amp; pstrServer &amp; ";Initial Catalog=" &amp; pstrDBS &amp; ";integrated security=sspi;"
  
  strSQLQuery = "BULK INSERT tbl_q_member " &amp; _ "FROM 'C:\test\bulk.csv' " &amp; _ "WITH (FIRSTROW = 2, FIELDTERMINATOR = ',',ROWTERMINATOR = '\n', TABLOCK)"
  
  connServer.Execute strSQLQuery
  </code></pre>
  
  <p>The runtime error is </p>
  
  <blockquote>
    <p>'-2147217865 (800440e37)</p>
    
    <p>Invalid object name 'tbl_q_member'</p>
  </blockquote>