Hi all.
The following command don't work on ours SQL server anymore. Not sure why,
but could it be that the command "Net Send" is removed for NT 2000?
Any ideas.
Thanks
Geir
DECLARE @.Message varchar(255)
Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST, Price
to low!. Order 6555 '
EXEC master.. xp_cmdshell @.Message, no_outputHi
Is your SQL Server Service Account a Domain account? If not, change it to a
domain account.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Geir Holme" <geir@.multicase.no> wrote in message
news:%23lrHkVOxFHA.3720@.TK2MSFTNGP11.phx.gbl...
> Hi all.
> The following command don't work on ours SQL server anymore. Not sure why,
> but could it be that the command "Net Send" is removed for NT 2000?
> Any ideas.
> Thanks
> Geir
> DECLARE @.Message varchar(255)
> Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST,
> Price to low!. Order 6555 '
> EXEC master.. xp_cmdshell @.Message, no_output
>|||Hi
See this example written by Tibor
USE master
GO
CREATE PROC sp_dbm_notify_users @.msg VARCHAR(255) AS
/ ****************************************
***********************************
****/
/* This procedure does a NET SEND to all connected computers.
*/
/* Requires that the messenger service is running on the client.
*/
/* The bat file is a sample showing how a message can be sent from the OS.
A */
/* shortcut to the bat file can be placed on the desktop, for instance
*/
/* The procedure takes the following parameter:
*/
/* @.msg VARCHAR(255) (required): The message to be sent
*/
/* Written by Tibor Karaszi and Brje Carlsson 1999. www.dbmaint.com
*/
/* Tested on verion 6.5, 7.0 and 8.0.
*/
/ ****************************************
***********************************
****/
SET NOCOUNT ON
--Get version number and verify supported version
DECLARE @.ver VARCHAR(7)
SELECT @.ver = CASE
WHEN CHARINDEX('6.50', @.@.VERSION) > 0 THEN '6.50'
WHEN CHARINDEX('7.00', @.@.VERSION) > 0 THEN '7.00'
WHEN CHARINDEX('8.00', @.@.VERSION) > 0 THEN '8.00'
ELSE 'Unknown'
END
IF @.ver = 'Unknown'
BEGIN
RAISERROR('Unsupported version of SQL Server.',16,1)
RETURN -101
END
--Declare variables section
DECLARE loop_name INSENSITIVE CURSOR FOR
SELECT DISTINCT LTRIM(RTRIM(hostname))
FROM master..sysprocesses
WHERE DATALENGTH(LTRIM(RTRIM(hostname))) > 0
OPEN loop_name
DECLARE @.host_name VARCHAR(30)
DECLARE @.exec_str VARCHAR(255)
FETCH NEXT FROM loop_name INTO @.host_name
WHILE (@.@.fetch_status = 0)
BEGIN
SELECT @.exec_str = 'master..xp_cmdshell "NET SEND ' + @.host_name + ' '
+ @.msg + '"'
EXEC( @.exec_str)
FETCH NEXT FROM loop_name INTO @.host_name
END
DEALLOCATE loop_name
GO
/* Sample Execution:
EXEC sp_dbm_notify_users 'SQL Server will shut down in 30 minutes!'
*/
"Geir Holme" <geir@.multicase.no> wrote in message
news:%23lrHkVOxFHA.3720@.TK2MSFTNGP11.phx.gbl...
> Hi all.
> The following command don't work on ours SQL server anymore. Not sure why,
> but could it be that the command "Net Send" is removed for NT 2000?
> Any ideas.
> Thanks
> Geir
> DECLARE @.Message varchar(255)
> Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST,
> Price to low!. Order 6555 '
> EXEC master.. xp_cmdshell @.Message, no_output
>|||it's possible that your messenger service may be shut down (check start ->
run-> services.msc -> messenger).
Regards,
Mary
"Geir Holme" <geir@.multicase.no> wrote in message
news:%23lrHkVOxFHA.3720@.TK2MSFTNGP11.phx.gbl...
> Hi all.
> The following command don't work on ours SQL server anymore. Not sure why,
> but could it be that the command "Net Send" is removed for NT 2000?
> Any ideas.
> Thanks
> Geir
> DECLARE @.Message varchar(255)
> Set @.Message = 'net send USER Message to OLNY from SAM : . TEST, TEST,
> Price to low!. Order 6555 '
> EXEC master.. xp_cmdshell @.Message, no_output
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment