Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003

    Cool Unanswered: When Server reboots automatically call procedure SQLSERVER


    Does anyone know how to automatically run a procedure when
    a server reboots on SQL Server 2000?

    Thanks you!!!

  2. #2
    Join Date
    Sep 2003
    Sets procedure options.

    sp_procoption [ @ProcName = ] 'procedure'
    , [ @OptionName = ] 'option'
    , [ @OptionValue = ] 'value'

    [@ProcName =] 'procedure'

    Is the name of the procedure for which to set or view an option. procedure is nvarchar(776), with no default.

    [@OptionName =] 'option'

    Is the name of the option to set. The only value for option is startup, which sets stored procedure for autoexecution. A stored procedure that is set to autoexection runs every time Microsoft® SQL Server™ is started.

    [@OptionValue =] 'value'

    Is whether to set the option on (true or on) or off (false or off). value is varchar(12), with no default.

    Return Code Values
    0 (success) or error number (failure)

    Execute permissions default to members of the sysadmin fixed server roles. Startup procedures must be owned by the database owner in the master database.

  3. #3
    Join Date
    Sep 2003
    You can also set up a sql scheduled task, and let it kick off when the agent service starts. I don't have enterprise manager in front of me, but I believe it's on the the 'schedule' tab in the job.

  4. #4
    Join Date
    Jun 2003
    Pinion is corrected.
    On the Schedule Tab and below the "Schedule Type", checked the "Start automatically when SQL Server Agent starts" . However, make sure in the SQL Server Agent's Properties, set the "Auto restart SQL Server if it stops unexpectedly". Nevertheless, sometime I experienced the SQL Agent didn't even started after a reboot, so if you're absolutedly wanted to run something after each reboot, write a batch script to execute a query IMHO.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts