Is it possible to start a stored procedure automatically without sql sever agent?

Hello, I am using MS SQL Management Studio express 2005, and I need the stored procedure to be activated daily.

However, I do not have an SQL agent.

Managemnet studio will not be open daily, so I can not use the start script.

Does anyone know how to do this without an agent?

Thanks in advance.

+3
source share
4 answers

you can use sqlcmd

http://msdn.microsoft.com/en-us/library/ms162773.aspx

it will be in a batch file and scheduled through the window scheduler

example below

sqlcmd -E -S localhost -q "select count(1) from databasename.dbo.tablename"

this will connect to sql on the local computer and execute a row in the table in the database

+3
source

script, script.

+1

You can create a scheduled Windows task to start a command line client osql.

+1
source

This is not very, but you can create a stored procedure in master:

use master
go
CREATE PROCEDURE DoStuffDaily
AS
    WHILE 1=1
    BEGIN
        WAITFOR TIME '00:05' --5 past midnight?
        EXEC <yourdb>.<schema>.<proc>
    END
go

Then simply mark this saved proc as a startup procedure using sp_procoption and restart SQL Server.

+1
source

Source: https://habr.com/ru/post/1794416/


All Articles