title: How do I access nested SQL tables in R?
body: <p>From R Studio's <a href="https://db.rstudio.com/odbc/" rel="nofollow noreferrer">ODBC database documentation</a> I can see a simple example of how to read a SQL table into an R data frame:</p>
  
  <pre><code>data &lt;- dbReadTable(con, "flights")
  </code></pre>
  
  <p>Let me paste a graphic of the <code>BGBUref</code> table(?) I'm trying to read to an R data frame. This is from my connection pane in R studio.</p>
  
  <p><a href="https://i.stack.imgur.com/WOdn5m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WOdn5m.png" alt="nested table"></a></p>
  
  <p>If I use the same syntax as above, where <code>con</code> is the output of my <code>dbConnect(...)</code>  I get the following:</p>
  
  <pre><code>df &lt;- dbReadTable(con, "BGBURef")
  #&gt; Error: &lt;SQL&gt; 'SELECT * FROM "BGBURef"' nanodbc/nanodbc.cpp:1587: 42S02: 
  #&gt; [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid object name
  #&gt; 'BGBURef'.
  </code></pre>
  
  <p>Is my understanding of what a "table" is incorrect? Or do I need to do something like this to get to the nested <code>BGBUref</code> table:</p>
  
  <pre><code>df &lt;- dbReadTable(con, "QnRStore\dbo\BGBURef")
  #&gt; Error: '\d' is an unrecognized escape in character string starting ""QnRStore\d"
  </code></pre>
  
  <p>The <code>BGBUref</code> data frame will come up in R Studio if I click on the little spreadsheet icon. I just can't figure out how to get it into a defined data frame, in my case <code>df</code>.</p>
  
  <hr>
  
  <p>Here's the output when I run these commands:</p>
  
  <pre><code>df &lt;- dbReadTable(con, "QnRStore")
  #&gt; Error: &lt;SQL&gt; 'SELECT * FROM "QnRStore"'
  #&gt; nanodbc/nanodbc.cpp:1587: 42S02: [Microsoft][ODBC Driver 17 for SQL 
  #&gt; Server][SQL Server]Invalid object name 'QnRStore'. 
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>dbListTables(con)
  #&gt;  [1] "spt_fallback_db"                                         
  #&gt;  [2] "spt_fallback_dev"                                        
  #&gt;  [3] "spt_fallback_usg"                                        
  #&gt;  [4] "spt_monitor"                                             
  #&gt;  [5] "trace_xe_action_map"                                     
  #&gt;  [6] "trace_xe_event_map"                                      
  #&gt;  [7] "spt_values"                                              
  #&gt;  [8] "CHECK_CONSTRAINTS"                                       
  #&gt;  [9] "COLUMN_DOMAIN_USAGE"                                     
  #&gt; [10] "COLUMN_PRIVILEGES" 
  #&gt; ...
  #&gt; [650] "xml_schema_types"                                        
  #&gt; [651] "xml_schema_wildcard_namespaces"                          
  #&gt; [652] "xml_schema_wildcards"
  </code></pre>