Add a trigger to a system table?

  • I need to capture when a new database is created in a SQL 2000 instance.

    The logical thing to do would be to put an insert trigger on sysdatabases, but it is not possible to put a trigger on a system table (or a view referencing a system table).

    The solution I have arrived at is to create a table containing a copy of all the spid's from sysdatabases and compare this to sysdatabases via a scheduled job every hour or so to see if any new ones have appeared.

    Anyone got any better ideas?

  • What about the crdate

    Select * from Master..SysDatabases

    Where CRDate>=DateAdd(d,-1,GetDate())

  • That works very nicely thank you.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply