Wouldn't it be nice if you have a mechanism to notify users that are connected to your SQL Server? Here's a stored procedure that an help you do that task.
CREATE PROC spSendNetworkNotification@Message VARCHAR(200)ASBEGIN SET NOCOUNT ONDECLARE @ShellCommand VARCHAR(350)DECLARE @MessageSource SYSNAMESELECT @MessageSource= min(RTRIM(@MessageSource))FROM master.dbo.sysprocesses (NOLOCK)WHERE @MessageSource <> ''WHILE @MessageSource is not nullBEGIN SET @ShellCommand='EXEC master.dbo.xp_cmdshell "NET SEND ' + LTRIM(RTRIM(@MessageSource)) + ' ' + LTRIM(RTRIM(@Message)) + ' "'EXEC (@ShellCommand) SELECT @MessageSource= min(RTRIM(@MessageSource)) FROM master.dbo.sysprocesses (NOLOCK) WHERE @MessageSource <> '' and @MessageSource > @MessageSourceENDSET NOCOUNT OFFEND
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.