+ Reply to Thread
Results 1 to 4 of 4

Call Stored Proc With Parameters From Excel

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Call Stored Proc With Parameters From Excel

    I missed out in the Title that its a SSMS Stored Procedure

    Please Login or Register  to view this content.
    This procedure runs perfectly when the Red line is commented and Green line is uncommented. But when I comment the Green line and Run the Red Line, it returns an error (Screenshot Attached) on the Blue Line.

    Surprisingly, the Red Line executed perfectly fine on SSMS.

    I tried changing adCmdText to adCmdStoredProc but does not seem to work.

    Can anyone guide me what might be wrong?
    Attached Images Attached Images
    Last edited by NeedForExcel; 06-21-2017 at 06:31 AM.
    Cheers!
    Deep Dave

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Call Stored Proc With Parameters From Excel

    I am not going to give you the full code, but you have left out a number of commands. You can google it.

    Please Login or Register  to view this content.
    Last edited by AB33; 06-21-2017 at 10:45 AM.

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Call Stored Proc With Parameters From Excel

    Hi AB33,

    Thank you for the reply.

    Actually I had done something very similar before posting it to Excel Forum.

    This is what my code looked like -

    Please Login or Register  to view this content.
    But the return_value seems to be the troublesome part.

    I also tried changing adParamReturnValue to adParamOutput. I also tried placing ReturnValue as the 1st parameter in the code.

    I get an error -

    Run-time error '-2147217900 (80040e14)'

    Procedure or function Customer_Data has too many arguments specified. (It is treating the return value as a Parameter) I am not very sure how to handle return value because of my limited knowledge of SQL.
    Last edited by NeedForExcel; 06-22-2017 at 01:57 AM.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Call Stored Proc With Parameters From Excel

    Hi!

    I have managed to resolve the problem.

    The issue was at the the SQL Level. As soon I added the line "Set NOCOUNT ON" the Code started working.

    Thank you for the help.



    Rep Added
    Last edited by NeedForExcel; 06-22-2017 at 02:22 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 10-09-2013, 06:48 AM
  2. Chg input parameters on SQL Stored Proc Source on PowerPivot
    By JExpWbNewbie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2013, 02:45 PM
  3. Running SQL Stored Proc through Excel VBA
    By JezLisle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2009, 07:47 AM
  4. [SOLVED] Call SQL Server Stored Procedures with parameters,
    By KCSL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2006, 12:10 PM
  5. [SOLVED] SQL Stored proc - passing parameters
    By Harish Mohanbabu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2006, 01:00 PM
  6. [SOLVED] execute stored proc in Excel
    By William in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2006, 06:55 PM
  7. DAO recordset Call to SQL Stored Proc
    By Datasort in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-01-2005, 02:10 PM
  8. Calling stored proc with parameters ..
    By Harish Mohanbab in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1