Send NET SEND Messages

Send NET SEND Messages

This code is how to send NET SEND messages to all the connected SQL Server users in an NT local area network:

 CREATE PROC notify_users(@notification VARCHAR(100) = 'SQL Server shutting down')ASBEGINSET NOCOUNT ONDECLARE @msg VARCHAR(250)DECLARE @hostname sysnameSELECT @hostname= min(RTRIM(hostname))FROM  master.dbo.sysprocesses (NOLOCK)WHERE  hostname <> ''WHILE @hostname is not null    BEGIN	set @msg='exec master.dbo.xp_cmdshell "net send ' + RTRIM(@hostname) + '' + RTRIM(@notification) + ' "'        EXEC (@msg)  	SELECT @hostname= min(RTRIM(hostname))	FROM  		master.dbo.sysprocesses (NOLOCK)	WHERE  		hostname <> ''		and hostname > @hostname    ENDSET NOCOUNT OFFEND
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular