SQL Server Performance

database level trigger

Discussion in 'SQL Server 2005 General DBA Questions' started by zsamz, Sep 7, 2007.

  1. zsamz New Member

    is there a database level trigger in SQL server. I just want to send an email if the server is rebooted. how do I do it.
    any help is appreciated
  2. Adriaan New Member

    At least in 7.0 and 2000, you could set a sproc to be executed on startup of the SQL Server service. Check out sp_procoption in Books Online.
  3. Adriaan New Member

    I know the original poster was asking about database level triggers, but that's not the solution for the problem he described.
    sp_procoption is the solution here - it allows you to set a sproc to be executed when the instance of SQL Server starts up, which is what happens when the server is rebooted (assuming that the SQL Server service is set to start when Windows is booted, and that it starts without a problem).
    If you create the sproc in master this should always fire.
  4. satya Moderator

    I would suggest to take help of alerting software which will be best way forward than depending upon triggers, you can refer to the software spotlight articles section in this website for more information on SMTP alerting software.
  5. WingSzeto Member

    To answer your question "is there a database level trigger in SQL server", In SQL 2005, it introduces DDL triggers which have two scope levels; database and server. But the statements you can use in the server level are limited. You can check book-on-line for it. If you are creative enough, you may be able to use it to do what you want.

Share This Page