title: How do I connect to an SQL server database in R
body: <p>I'm trying to connect to the SQL Sever database using R but not sure on the details for the query string. I normally use SQL server management studio on SQL Server 2008 and connnect using single sign on. I found the below example </p>
  
  <pre><code>myconn &lt;- odbcDriverConnect(connection="Driver={SQL Server 
  Native Client 11.0};server=hostname;database=TPCH;
  trusted_connection=yes;")
  </code></pre>
  
  <p>I get the below warning message</p>
  
  <pre><code>Warning messages:
  1: In odbcDriverConnect(connection = "Driver={SQL Server \nNative Client 11.0};server=hostname;database=TPCH;\ntrusted_connection=yes;") :
    [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
  2: In odbcDriverConnect(connection = "Driver={SQL Server \nNative Client 11.0};server=hostname;database=TPCH;\ntrusted_connection=yes;") :
    ODBC connection failed
  </code></pre>
  
  <p>How do I go about finding the specifics i need?</p>