Link to home
Start Free TrialLog in
Avatar of HNA071252
HNA071252Flag for United States of America

asked on

SQL Server - Execute SQL Server store procedure from Excel

Hi,

Could you please let me know why my code below isn't working?

        Set cmd = New ADODB.Command
        cmd.ActiveConnection = Cn
        cmd.CommandText = "Exec TRP.M_Par_update_process"
        'cmd.CommandTimeout = 1200               ' 20 minutes
        cmd.CommandType = adCmdStoredProc
        cmd.Execute , , adAsyncExecute
        MsgBox ("Loaded & Processed!")

When a button in Excel is clicked, I want it to execute a store procedure name "TRP.M_Par_update_process" in the SQL Server without having to wait in Excel until the procedure is completely done.
ASKER CERTIFIED SOLUTION
Avatar of nutsch
nutsch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HNA071252

ASKER

When I executed the store procedure using adAsyncExecute, how do I know when it's finish running? From the SQL Server Management Studio window, how do I check what are the procedures currently running?
SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi all

I know this question has already been answered, but if it helps I finished an article on how to build an Excel front-end, SQL Server Stored Procedure back-end that allows users to enter cell-based parameters:

Microsoft Excel & SQL Server:  Self service BI to give users the data they want
If you like what you see, please click the 'Yes' button next to 'Was this article helpful?', and provide some feedback.

Thanks in advance.
Jim