September 23, 2003 at 7:47 am
Is there a way to send a NetSend message within a SQL Task?
DECLARE @notify_netsend_operator_name varchar(50)
SET @notify_netsend_operator_name = 'PROBLEMS WITH THIS DTS'
EXECUTE @notify_netsend_operator_name = N'kbrady'
I have a SQL task that does one of two things and for both those things I would like a message to popup. I know that I could do this in ActiveX or by selecting a Workflow option to go to SQL Mail. Im really trying to keep this within the one SQL task. Is there a within a SQL task to exit out of a portion of the task based on the results within a task. So if my SQL task looked like this:
SET @myVar = (SELECT ID FROM TABLE WHERE ID = 1)
IF @myVar <> BEGIN
-- SEND A MESSAGE or GO TO ANOTHER SQL TASK
END
ELSE IF @myVar = "" BEGIN
-- SEND A MESSAGE or GO TO ANOTHER SQL TASK
END
September 23, 2003 at 8:52 am
quote:
Is there a way to send a NetSend message within a SQL Task?
exec master..xp_cmdshell 'net send \\hostname <<message>>'
Should work.
Thomas Rushton
blog: https://thelonedba.wordpress.com
September 23, 2003 at 1:16 pm
Thanks, I end up figuring out. Would you also happen to know if there was a way to get the value from a global variable within a SQL task? Thanks
September 23, 2003 at 6:36 pm
To use global variables in the SQL statement of an ExecuteSQL task, put a ? for each parameter required, click the Parameters... button and assign Input parameters as required.
Hope this helps
Phill Carter
--------------------
Colt 45 - the original point and click interface
--------------------
Colt 45 - the original point and click interface
October 1, 2003 at 3:41 pm
You can build the command before going to xp_cmdshell....
SET @cmd = 'NET SEND ' + @Recipient + ' ' + @Message
EXEC master.dbo.xp_cmdshell @cmd, NO_OUTPUT
Steve Phelps
SQL Server DBA
American Fidelity Group
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy