HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to automatically execute a stored procedure every day at a particular time?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storedautomaticallyeverytimeprocedurehowparticulardayexecute

Problem

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.

Solution

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 :

Scheduling Jobs in SQL Server Express - Part 1 and

Scheduling Jobs in SQL Server Express - Part 2

-
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"

Code Snippets

sqlcmd -E -S server_name -d database_name -Q "EXEC schema_name.StoredProcedureName @p1"

Context

StackExchange Database Administrators Q#50237, answer score: 8

Revisions (0)

No revisions yet.