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.
4 Answers
If you are not comfortable using Powershell, then you can go for native service broker functionality.
This might sound complex, but below links has all the scripts :
Alternatively, you can use Standalone SQL Agent - still in BETA statge from codeplex.
You can use the native sqlcmd functionality and then schedule it using windows scheduler or Schtasks
sqlcmd -E -S server_name -d database_name -Q "EXEC schema_name.StoredProcedureName @p1"
- 62,545
- 6
- 124
- 245
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?
- 70,928
- 22
- 177
- 323
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
The answer to the question "How to make a stored procedure automatic with execution parameters" in Sql server is simple, we will only have to go to the SQL server Agent, "New" -> "Job" -> we will use three tabs "General"," Steps","Schedules" in "General" we will only give it a name, "Steps" ->"New" and here we will have to add the execute of the stored procedure, "Schedules" we make the execution time parameters and save, I hope this is of help to someone, greetings