0

Im having problem with single value inserts. Using pyodbc

LL= []
....
sqla = 'INSERT INTO d.table VALUES (?,?,?,?,?,?,?)'
csr.executemany(sqla, LL)

Works, if LL is single column of data as a list...does not work.

LL= []
....
sqla = 'INSERT INTO d.table VALUES (?)'
csr.execute(sqla, LL)

How do I fix?

Then

LL= []
....
sqla = 'INSERT INTO d.table VALUES (?)'
csr.execute(sqla, LL)

If LL is Id only, The database table has cols of ID, AAA,BBB, CCC, How do I insert....

LL= [['TDW'], ['TD0'], ['TD0'], ['TDW'], ['TD10'] ]
1
  • Could we see a snippet of what LL looks like with data in it? Commented Mar 3, 2011 at 4:27

1 Answer 1

1
sqla = 'INSERT INTO d.table (column_name) VALUES (?)'

This is right syntax of INSERT QUERY.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.