首页 > 编程语言> > python-PYODBC ProgrammingError :(“ 42000”,“ [42000] [Microsoft] [Pilote ODBC Microsoft Access]
python-PYODBC ProgrammingError :(“ 42000”,“ [42000] [Microsoft] [Pilote ODBC Microsoft Access]
作者:互联网
我尝试使用另一个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,ms-access,pyodbc 来源: https://codeday.me/bug/20191121/2048781.html