Rename field in Access DB

Iain King iainking at gmail.com
Wed May 14 11:08:51 EDT 2008


I'm manipulating an MS Access db via ADODB with win32com.client.  I
want to rename a field within a table, but I don't know how to.  I
assume there is a line of SQL which will do it, but nothing I've tried
(from searching) has worked.
Basic code:

import win32com.client
connection = win32com.client.Dispatch(r'ADODB.Connection')
DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=dbfile.mdb;'
connection.Open(DSN)
connection.Execute("ALTER TABLE tablename CHANGE from to")   #this sql
doesn't work
connection.Close()

Anyone know how to get this to work?

Iain



More information about the Python-list mailing list