execute proc on stopping mssql server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Indrek Mägi

    execute proc on stopping mssql server

    How execute extended proc on stopping ms sql server (it mean before
    stoping).
    Is it possible to handle this?
    Or is in system proc a'la sp_on_stop?

    Thx


  • Erland Sommarskog

    #2
    Re: execute proc on stopping mssql server

    Indrek Mägi (mkkk@hotmail.c om) writes:[color=blue]
    > How execute extended proc on stopping ms sql server (it mean before
    > stoping).
    > Is it possible to handle this?
    > Or is in system proc a'la sp_on_stop?[/color]

    KILL on the spid in question is the only way I can think of. Short of
    rebooting the server.


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server SP3 at
    Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

    Comment

    • Guju

      #3
      Re: execute proc on stopping mssql server

      Try this,


      --Email when database is started

      CREATE procedure email

      as

      exec sp_sendSMTPmail 'test@test.com. au', 'Database Rebooted',
      @cc='', @BCC = '',
      @Importance=1,
      @Attachments='' , @HTMLFormat = 0,@From =
      'test@test.com. au'



      GO
      exec sp_procoption N'email', N'startup', N'true'
      GO


      Thanks,


      "Indrek Mägi" <mkkk@hotmail.c om> wrote in message
      news:4215cb43_2 @news.estpak.ee ...[color=blue]
      > How execute extended proc on stopping ms sql server (it mean before
      > stoping).
      > Is it possible to handle this?
      > Or is in system proc a'la sp_on_stop?
      >
      > Thx
      >
      >[/color]


      Comment

      Working...