Hi,
I want to create a table with multiple columns, say about 100 columns, in an sqlite database. Is there a better solution than naming each column individually? I am trying the following:
conn = sqlite3.connect('trialDB')
cur = conn.cursor()
listOfVars = ("added0",)
for i in range(1,100):
newVar = ("added" + str(i),)
listOfVars = listOfVars + newVar
print listOfVars
for i in listOfVars:
cur.execute('''ALTER TABLE testTable ADD COLUMN ? TEXT''',(i,))
conn.commit()
cur.close()
conn.close()
But I get the following error:
OperationalError: near "?": syntax error
Can someone please suggest how I can do this? Thanks!