4

Can you please help me how to execute a stored procedure automatically in SQL database without any transaction in SQL? I want to execute on particular fix time.

  • 1
    What database system are you using? SQL Server (Microsoft), MySQL, other? Please edit your question to add a tag for that. Also, what have you tried so far, what did you find in your research and why didn't that work? – Mat Sep 20 '13 at 5:52
  • It's a stored procedure - a procedure stored inside your database system. It has nothing to do with a "store" per se ... – marc_s Sep 20 '13 at 8:31
  • how about this? stackoverflow.com/a/8688446/2186023 and then just let task scheduler take control of that... – DrCopyPaste Sep 20 '13 at 8:45
  • 1
    And you can not execute anything in SQL without a transaction. ANYTHING is in a transaction - explicit or implicit. – TomTom Sep 20 '13 at 9:13
  • Cross-site duplicate of stackoverflow.com/q/4079363/164901 -- I recently implemented the Service Broker solution for one of our projects here, and I can tell you that it's not exactly newbie-friendly. It is a great solution, though. – Jon Seigel Sep 20 '13 at 13:31
6

If you are not comfortable using Powershell, then you can go for native service broker functionality.

4

With SQL Server Express, you could use powershell to execute a stored procedure automatically through Windows scheduler service.

There is a great article that shows how to use Powershell to EXEC stored procedures here:

http://www.maxtblog.com/2010/10/basic-sql-server-stored-procedure-scripting-with-powershell/

You can also look at this question that deals with using Powershell:

Is there any collection of PowerShell scripts that help the task of SQL Server maintenance?

2

Not sure what you mean by "without any transaction". But normally timed scripts / tasks are executed as jobs, through the SQL Server Agent. See here for an example and explanation.

https://stackoverflow.com/questions/1216272/how-to-execute-a-stored-procedure-in-a-sql-agent-job

  • @Khan SQL Agent is not available in Express edition. – Kin Shah Sep 20 '13 at 13:03
  • Ah, tags. Good point. :) – Kahn Sep 23 '13 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.