For doing that we need to create procedure first and also define the repeating interval to call it again
We will create procedure named getnotification from the particular database that gets fired after 3:30 hours on a daily basis.
When we gets connected with our database it gets executed automatically from the given time period
CREATE PROCEDURE GetNotification
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- The interval between cleanup attempts
declare @timeToRun nvarchar(50)
set @timeToRun = '03:33:33'
while 1 = 1
begin
waitfor time @timeToRun
begin
execute Assignment.GetNotification
end
end
END
-- Run the procedure when the database starts.
spprocoption @ProcName = 'GetNotification',
@OptionName = 'startup',
@OptionValue = 'on'
0 Comment(s)