473,388 Members | 1,209 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Send alert from job

I'm a newby and I have a quick question. I have set up this procedure
to run as a job. I can create a block and have it populate the table,
but I need to be alerted via email when the table is being populated. I
do not know what step/s am I missing. Here is the scripts I ran:

CREATE TABLE BlockMonitorInfo
(
spid smallint,
blocked smallint,
waittype binary,
InfoTime datetime
)
go
/*********creates a control table that lets you turn the background
process on and off**********/
CREATE TABLE BlockMonitorControl
(
BlockMonitorOn tinyint
)
go
/**********populates the control table and initially turns on the
background process******/
INSERT INTO BlockMonitorControl
VALUES (1)
go

/*
StartBlockMonitor accepts one datetime paramter that controls the
sampling delay for capturing blocking information
*/
drop PROC StartBlockMonitor
go
CREATE PROC StartBlockMonitor
@DelayTime char(9)
AS

DECLARE @CurrentInfoTime datetime

-- Set the control flag in BlockMonitorControl = On
update BlockMonitorControl set BlockMonitorOn = 1

-- Capture blocking lock info until the control flag is set = false
-- We set it off by running StopBlockMonitor which we'll create soon.

WHILE (SELECT BlockMonitorOn from BlockMonitorControl) = 1
BEGIN

SELECT @CurrentInfoTime = getdate()

INSERT INTO BlockMonitorInfo (spid, blocked, waittype, InfoTime )
SELECT
spid, blocked, waittype, @CurrentInfoTime
FROM
master..sysprocesses (nolock)
WHERE
blocked <> 0

WAITFOR delay @DelayTime
END
go

/*
StopBlockMonitor turns off the capture of blocking info by setting the
control flag in BlockMonitorControl = off
*/

DROP PROC StopBlockMonitor
go

CREATE PROC StopBlockMonitor
AS
UPDATE BlockMonitorControl SET BlockMonitorOn = 0
go

SELECT
BlockMonitorInfo.*
FROM
BlockMonitorInfo,
(SELECT distinct InfoTime FROM BlockMonitorInfo)
BlockChainTime
WHERE
BlockMonitorInfo.InfoTime =
BlockChainTime.InfoTime
and Blocked not in
(SELECT spid
FROM BlockMonitorInfo
WHERE InfoTime =
BlockChainTime.InfoTime)

This last query is what I have set up in a job, but I need the job to
alert us when the table gets new information added.

Thank you for the assistance!

Jul 23 '05 #1
1 1389

"Stephanie" <st*****@centene.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I'm a newby and I have a quick question. I have set up this procedure
to run as a job. I can create a block and have it populate the table,
but I need to be alerted via email when the table is being populated. I
do not know what step/s am I missing. Here is the scripts I ran:


<snip>

Assuming you have SQL Mail set up, then you can use xp_sendmail to send
email from within your procedure. If you don't have SQL Mail, then this is
one common alternative:

http://www.sqldev.net/xp/xpsmtp.htm

Simon
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
4
by: Steve Westwood | last post by:
I have a WebForm button. Depending on calculation I wont to send a popup message to the web page. I am not sure of the approach. From the server side code I don't seem to be able to access the...
3
by: Larry Bird | last post by:
I have a VB.Net service that I'm trying to send e-mail from. Below is my code: Dim MessageProcessing As New SageQuestMailer SendMailMessage(EmailAddresses) Function SendMailMessage(ByVal...
6
by: Tobierre | last post by:
Hi all, I've created the below function to automatically send me an alert in outlook when someone completes various forms on my website. The problem though is that mail reports that I have...
3
by: keith.schincke | last post by:
I know I must be missing something basic. I am developing of Firefox 1.5 and am trying to to send a basic QUERY_STRING to a test CGI that will print the data back to the brower: I can print my...
4
by: dols | last post by:
Hello, below the fragment that works fine, but nevertheless, the value of xmlhttp.status turns out to be zero (0), and the corresponding value for xmlhttp.statusText is "unknown". Does anyone...
4
by: FNA access | last post by:
I have read through many posts that are relevant to my topic and have not had any success. I want to click a button on my form and send an email to a list of people I have stored in a table with...
2
by: ajaxcoder | last post by:
Hi In my project i had a login form and i am trying to send the username and password to the server for authentication using xmlHttpRequest. Hence i am using POST request but i am unable to send...
0
by: nickyeng | last post by:
I have this following code which it makes me cannot send sms in my j2me application. import com.sun.midp.ssl.CryptoException; public class Encrypter { public static String...
1
sid0404
by: sid0404 | last post by:
Hi I need to send data from my servlet to my html(which contains AJAX), so as per the motivation of the AJAX, this should be done without my webpage reloading / refresh. my code on the ajax...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.