Thanks Angelll great adviceI will do that but how would I call sp_start_job from excel?
nutnut
Main Topics
Browse All TopicsHi,
I have a stored procedure on SQL Server 2000 that I would like to run from Excel.
The sp doesn't return any data to the excel spreadsheet it just updates tables on the SQL Server which i then linked to via pivot tables in Excel.
What is the easiest way and can I view progress of the sp in Excel as the sp can take 5-10 minutes?
Many Thanks
nutnut
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>I have gone to enter the code and have realised I need to pass a year and period parameter to the stored procedure, any idea how to do that - sorry!
I would have a table (proc_parameter) and store the parameters in there, and the procedure should then take the parameters from there.
if you do not want to change the existing procedure, create an additional procedure that reads the values from the table, and calls your original procedure with the values.
simply like this:
dim c as adodb.connection
set c = new adodb.connection
c.open "your connection string to the sql server"
c.execute "insert into proc_parameter (param1, param2) values ('" & Cells("A2") & "', '" & Cells("A3") & "' ) "
c.execute "exec msdb.dbo.sp_start_job @job_name = 'your job name' "
c.close
set c = nothing
I have a simular question. I have a stored procedure with 3 parameters which the results would then return to excel/
User would then have the ability to sort for filter the results using excel.
Sample of my stored proceedure
exec dbo.RCON_sp_TimCard '6/13/2009','0','1'
I see the code above, But I'm not sure how to set up the Agent job or the Macro.. or the connection string.
Thanks for the help
Business Accounts
Answer for Membership
by: angelIIIPosted on 2007-05-25 at 05:03:25ID: 19156095
I would NOT start the sp as such from excel, but make a sql agent job run the procedure, and in excel, just start the job (using sp_start_job) which will return the control directly to excel (ie the user).
still, you will have difficult to see "progress" per table, but you could make your procedure insert a record on completion of each table update, and maybe make a form to refresh that table contents...