Reply to Re: System event triggers

Your name:

Reply:


Posted by SQL Menace on 07/24/06 18:01

you can take a database offline or make it single user only

USE master
GO
ALTER DATABASE pubs
SET OFFLINE--use ONLINE to make it available again


>>Oracle has system event triggers, e.g. AFTER STARTUP, but I
> can't find an equivalent in SQL Server 2000.

Well you can create a procedure and have it execute every time the SQL
Server is restarted
The procedure has to be created in the master database, after it is
created you have to use sp_procoption to have the procedure execute
when SQL Server starts up

--Let's create our procedure
USE master
GO
CREATE PROCEDURE prStartUp
AS
SELECT GETDATE()
--You would do something real here
--like deleting the data
GO


--Make the procedure execute when the server starts up
sp_procoption prStartUp,startup,'on'


Denis the SQL Menace
http://sqlservercode.blogspot.com/


josh wrote:
> Hi, I have several independent, system components that write audit
> events to a database locally via ODBC and remotely via TCP, and I have
> a requirement to audit when the database is available for modification.
>
>
> First, does SQL Server have a concept of starting/stopping specific
> database instances? Or does my database instance "stop" only when the
> NT service MSSQLSERVER stops?
>
> Second, Oracle has system event triggers, e.g. AFTER STARTUP, but I
> can't find an equivalent in SQL Server 2000. What alternatives are
> there?
>
> Note that I can't rely on the MSSQLSERVER start/stop events in the NT
> Application Event log, as the events need to be inserted "in-band" into
> my database's event table.
>
> TIA,
> Josh

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация