1

I tried working with the solutions noted in Excel: Use a cell value as a parameter for a SQL query and How to add parameters to an external data query in Excel which can't be displayed graphically?. However, I can't get any of the solutions to work.

Below is a segment that I am having trouble with. There are multiple tables in the query. I pasted the SQL in the Command text in the Definition tab of the Connection Properties window. I have no problems when I enter the dates as they are below. However, I get a message about converting date and/or time from character string when I replace the dates with question marks. If I do the same and exclude the quote marks, I get a message about invalid parameter number.

I'm thinking that I should try to programatically update the connection file because I can't figure out how to acheive what I want to do any other way.

AND CAST(EXITED_FROM_ACTIVITY_DATE AS DATE) BETWEEN '2014-12-01' AND '2014-12-01'
4

1 回答 1

0

您可以在查询中使用日期格式,如下所示:

TO_CHAR(A.JOURNAL_DATE ,'YYYYMM') >='201506' and TO_CHAR(A.JOURNAL_DATE ,'YYYYMM') <='201506'

并且可以给出参数,201501 1可以延长周期 1 到 12

于 2015-08-11T13:00:28.197 回答