title: How to insert column from dataframe into SQL Server with pyodbc?
body: <p>I'm trying to insert data from a CSV (or DataFrame) into MS SQL Server.
  The table has already been created, and I created the columns in SQL using pyodbc.</p>
  
  <p>I'm trying to populate the first column in a table with one column from the DataFrame but I get this error:</p>
  
  <blockquote>
    <p>Error: ('07002', '[07002] [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error (0) (SQLExecDirectW)')</p>
  </blockquote>
  
  <p>I've tried adding a different column to see if it was an issue with that specific column and I get the same error. (There are no null values in the column.)</p>
  
  <pre class="lang-py prettyprint-override"><code>conn = pyodbc.connect("Driver={SQL Server};" 
                        "Server=natsqldevap2ncr\ins2;"
                        "Database=ECDWDEV;"
                        "Trusted_Connection=yes;")
  
  for i in df.iloc[:,0]:
      insert_query1 =  """INSERT INTO TABLE_NAME(COLUMN_NAME) 
                     VALUES 
                     (?)"""
  
      cursor = conn.cursor()
      result = cursor.execute(insert_query1)
      conn.commit()
  </code></pre>
  
  <p>Expecting all the values in the column (df.iloc[:,0]) to be inserted into the column "COLUMN_NAME" in the SQL table "TABLE_NAME".</p>
  
  <p>Instead get:</p>
  
  <blockquote>
    <p>Error: ('07002', '[07002] [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error (0) (SQLExecDirectW)')</p>
  </blockquote>