Hello:
I have a SQL query that I wrote that begins with the following declaration: DECLARE @DATE DATETIME. I do not have this code saved as a view/stored procedure nor do I want to do so.
I simply want to use Excel 2010 Microsoft Query to pull data from SQL through my view and allow users to enter a date in a spreadsheet and have that date passed to the @DATE variable in my code in Microsoft Query.
@DATE is used throughout my query (code), as a variable for "date" and again this date is to be entered by the end user and compared with other date fields in the query.
When I walk through the Microsoft Query wizard, I choose some table that contains a date field. Then, instead of returning data to Excel right away, I "put myself" in that window where you can add criteria. (I forget the window's name.)
So, I use that window to create a parameter "placeholder" called [SumDate]. Then, I return the data to Excel.
Afterward, I place a date in a cell in the spreadsheet. Then, I click the "Data" menu selection and go to "Connections".
At the bottom, in the "Definition" section, I replace the query in that section with my code (query).
Then I click the "Parameters" button to tell Excel to pull the date from that spreadsheet cell that I mentioned.
So, if you think about it, @DATE from my code is to equal the parameter that again is to represent a date that I place in a cell in my spreadsheet.
But, Excel is not paying any attention to this parameter.
What am I doing wrong? Why can I not get this parameter to pull from the spreadsheet to "populate" my code's @DATE variable?
Also, I don't want to use a stored procedure or VBA. I'm trying to keep this simple.
I just need to know the basics of doing so, after I paste my query into the Data...Connections...Properties...Command section.
That's really what I need.
Thanks! Much appreciated!
John