How to parameterize datestamp in pyODBC query?
问题 I'm using pyodbc together with QODBC to construct an ODBC query. I'm having trouble inserting datestamp parameters. Here you can see the escalation starting from the literal version (1) to string-format version (2) to error-state versions. ( Note DateFrom & DateTo ): sql = "sp_report ProfitAndLossStandard show Amount_Title, Text, Label, Amount parameters DateFrom = {d'2018-02-12'}, DateTo = {d'2018-02-18'}, SummarizeColumnsBy='TotalOnly', ReturnRows='All'" sql = "sp_report