Sunday, February 26, 2012

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?

ThxIndrek Mgi (mkkk@.hotmail.com) writes:
> 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?

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@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||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 Mgi" <mkkk@.hotmail.com> wrote in message
news:4215cb43_2@.news.estpak.ee...
> 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

No comments:

Post a Comment