Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send message to user with net send?

Status
Not open for further replies.

gcole

Programmer
Aug 2, 2000
390
0
0
US
I have created a trigger that checks the integrity of effective dates on insert and update. I need to notify the user of they are trying to add illegal (my rules) dates. I can't use mail (not setup on server). How do I do this with net send? I have the trigger and the alert.
Thanks,
Gail
 
I use this in my code all the time...When an email is too much.

Shell "net send " & strUsername & " " & strMessage, vbNormalNoFocus

It has always worked for me...


Mike
 
Are you doing this in T-SQL or VB? I think I can translate it to T-SQL without the vbNormalNoFocus.
Thanks
 
Do you know the command to get the logged in user? VB or SQL
 
If you have permission to execute xp_cmdshell you can use the following.

exec master..xp_cmdshell 'net send hostname',no_output Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
I wrote the following sp to handle this. It uses the machine name to send the message.

/*

June 7, 2002

Author: Gail Cole

Purpose: Sent a NET message to the logged in user
Inputs: Message to send
Modifed:

*/

CREATE PROCEDURE sp_db_SentNETMessage
@Msg varchar(100)
AS
set nocount on


DECLARE @Cmd as varchar(1000)
DECLARE @Host as varchar (50)

Set @Host = Host_name()

Set @Cmd = 'net send ' + @Host + ' ' + @Msg
execute master..xp_cmdshell @Cmd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top