473,569 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 BlockMonitorInf o
(
spid smallint,
blocked smallint,
waittype binary,
InfoTime datetime
)
go
/*********create s a control table that lets you turn the background
process on and off**********/
CREATE TABLE BlockMonitorCon trol
(
BlockMonitorOn tinyint
)
go
/**********popul ates the control table and initially turns on the
background process******/
INSERT INTO BlockMonitorCon trol
VALUES (1)
go

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

DECLARE @CurrentInfoTim e datetime

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

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

WHILE (SELECT BlockMonitorOn from BlockMonitorCon trol) = 1
BEGIN

SELECT @CurrentInfoTim e = getdate()

INSERT INTO BlockMonitorInf o (spid, blocked, waittype, InfoTime )
SELECT
spid, blocked, waittype, @CurrentInfoTim e
FROM
master..sysproc esses (nolock)
WHERE
blocked <> 0

WAITFOR delay @DelayTime
END
go

/*
StopBlockMonito r turns off the capture of blocking info by setting the
control flag in BlockMonitorCon trol = off
*/

DROP PROC StopBlockMonito r
go

CREATE PROC StopBlockMonito r
AS
UPDATE BlockMonitorCon trol SET BlockMonitorOn = 0
go

SELECT
BlockMonitorInf o.*
FROM
BlockMonitorInf o,
(SELECT distinct InfoTime FROM BlockMonitorInf o)
BlockChainTime
WHERE
BlockMonitorInf o.InfoTime =
BlockChainTime. InfoTime
and Blocked not in
(SELECT spid
FROM BlockMonitorInf o
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 1395

"Stephanie" <st*****@centen e.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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
2811
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) My code is below. I am getting the following error "MyForm.oNetwork.Value is Null or is not an object". I'm struggling to diagnose what to do next. ...
4
1778
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 client side script. Can anyone help? I am using the VS .net C# environment
3
3071
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 EmailAddresses) Dim ToAddress As String = "lbyrd@sage-quest.com"
6
1620
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 only 1 of the 3 required parameters defined! I have no idea where this is going wrong, because as far as I can tell I have defined all 3 parameters!...
3
8169
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 query string with an alert() right before the request.send(queryString). An examination of the cgi enviroment and tcpdump does not show QUERY_STRING...
4
6535
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 know the details of ALL the statuscodes when the value for readyState is 4 (= completed). Also, where could I have found the answer myself???
4
3016
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 email addresses. My SMTP server uses many defaults(ie port, timeout) I have been asked to leave the defaults alone, if possible. Here is a...
2
4202
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 data. I tried sending using GET request and GET is working fine. Here is code snippet function postRequest() { \n\ if(window.ActiveXObject) \n\...
0
2483
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 toHexString(byte ab) { StringBuffer sb = new StringBuffer(ab.length * 2) ;
1
8121
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 side is something like this: var xmlHttp = false; function getXMLHttpRequest(val) {
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.