0

Looking for some help with this as me and my 'Mentor' are having some issues with resolving the problem

I have a stored procedure in SQL Server 2016 that works fine when dates are entered. However I need an Excel sheet to execute the stored procedure, which currently is also working fine.

The issue is when I'm trying to use a parameter with Excel to pass through the dates to the SQL query/stored procedure that I need to bring back. I'm struggling to link the two up to each other

The second answer here by mono código > how to pass parameters to query in SQL (Excel) - should work for me, however when I get to the part which explains 'The code in the next section assumes that you already have a parameter in your query (Connection Properties->Definition->Command Text) in the form “WHERE (DB_TABLE_NAME.Field_Name = ‘Default Query Parameter')” (including the parentheses). Clearly “DB_TABLE_NAME.Field_Name” and “Default Query Parameter” will need to be different in your code'

I'm unsure if this is due I just simply do not know how to write this part, or it's to do with how I'm trying to link up the cells within excel to the parameters within SQL

For some more context, the parameters are dates - to and from, which will be in an excel sheet, which will then feed through to a query, which is where the execute code for the stored procedure is.

If any help or guides or walkthrough's could be given I'd very much appreciate them!

Thanks,

Wil-Liam

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Wil-Liam
  • 49
  • 8
  • What is the question? What are table and field names in your database? You will have to look at the database to see. – Jacob H Dec 11 '17 at 15:44
  • Hi Jacob H, the question is - 'The issue is when I'm trying to use a parameter with Excel to pass through the dates to the SQL query/stored proc that I need to bring back. I'm struggling to link the two up to each other' – Wil-Liam Dec 11 '17 at 16:21
  • If you were to share the code where the problem/error is happening then we could formulate a better answer to your question. – Xabier Dec 12 '17 at 13:08

0 Answers0