Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • To Run Stored Procedure everyday

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 323
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: