我需要在传递到windows批处理文件中的SQL查询中使用%字符。我的问题是这个角色没有被考虑在内。
towns=(12232, 12233)
for %%a in %towns% do (
"C:\Program Files\PostgreSQL\9.4\bin\pgsql2shp.exe" -h localhost -u thomas -P password thomas_db "SELECT * FROM schema.table WHERE code like '%%a%'"
)我得到以下错误:
C:\batch><“C:\Program-Files\PostgreSQL\9.4\bin\pgsql2shp.exe”-h localhost -u -P -P密码thomas_db“从schema.table选择*,代码像‘12232’>初始化.错误:无法确定表元数据
LIKE '%%a%'被解释为LIKE '12232',应该被解释为LIKE '12232%'。
发布于 2016-02-29 13:17:07
双倍的人会逃避百分之一,所以要加倍:
... WHERE code like '%%a%%%'"https://stackoverflow.com/questions/35700495
复制相似问题