我尝试在另一个 mdb 上使用左连接进行更新查询。
进入第一个 MDB 的游标,我执行此查询:
update table as ori
left join (select *
from param in "E:/Jeter/param_141114.mdb"
where zone = '1H005') param
on ori.dep_sur = param.dsu_co
set ori.texture = param.textu where mid(ori.type,4,1) in ('0','7','8')
当我从 Microsoft Access 启动此查询时,没问题,查询已应用。
当我使用 pyodbc 从 python 2.7 启动这个查询时,这里我的结果是从法语翻译过来的:
ProgrammingError ('42000', "[42000] [Microsoft] [ODBC Microsoft Access Driver] The database engine can not find [E: /Jeter/param_141114.mdb] 'Make sure the name. parameter or alias is valid, he does not understand character or incorrect punctuation and that it is not too long. (-1002) (SQLExecDirectW) ")
一些想法?
最佳答案
显然 SELECT ... FROM TableName IN "FileName"...
语法不适用于来自外部应用程序的 ODBC 查询。但是,我只是尝试了以下变体并且它对我有用(Python 2.7 和 pyodbc):
sql = """
update tableau as ori
left join (select *
from [C:/__tmp/test.mdb].param
where zone = '1H005') param
on ori.dep_sur = param.dsu_co
set ori.texture = param.textu
"""
crsr = db.execute(sql)
crsr.commit()
关于python - PYODBC ProgrammingError : ('42000' , “[42000] [Microsoft][Pilote ODBC Microsoft Access],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26938930/