Thursday, January 8, 2009

[Notification] and a version to watch a SPID


WHILE (SELECT COUNT(*)
FROM sysprocesses WHERE spid = 230 AND cmd IN ('ALTER table','CREATE index')
)>=1
BEGIN
PRINT 'waiting'
WAITFOR DELAY '00:01:00'
END

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'DBA',
@recipients = 'dba@thebakingdba.com',
@subject = 'index creation done'

No comments: