Thursday, January 7, 2016
Run a SQL Server procedure from Excel
I'm using SQL Server 2008 Enterprise. I created a stored procedure in one database. The stored procedure is composed of several queries from the same database. Final combined result set is being displayed.
I try to execute it via Excel to create a report from the output which I got from stored procedure, so the results will appear automatically in Excel sheet, but I'm getting the below error:
Once I was creating the SP with the simple SQL Queries, it was working fine, but not for the stored procedure which are having multiple queries, loops and other functionality
After trying various different option, I found the solution of this.
I added "SET NOCOUNT ON" to the beginning of the stored procedure.
Here is the link which can be helpful to read about this.