| Aaron [SQL Server MVP] 2005-02-28, 4:00 am |
| Yes, but this is a pretty horrible use of a trigger, IMHO. Why don't you
check the table at 1:00 AM (or some time after the DTS package is known to
have finished, that makes sense), instead of trying to send an e-mail the
instant the value is inserted?
Anyway, assuming you are using xp_sendmail, and we can't change your mind:
CREATE TRIGGER dbo.SendMailFutile
ON dbo.Escallation
FOR INSERT
AS
BEGIN
IF @@ROWCOUNT > 0
BEGIN
IF EXISTS (SELECT 1 FROM inserted WHERE Calls = 'ASAP12')
EXEC master..xp_sendmail ...
END
END
GO
See http://www.aspfaq.com/2403 for an example of my initial suggestion, as
well as details on an alternative to xp_sendmail.
A
On 2/27/05 8:47 PM, in article
DBC72044-63B5-4257-9F49-CE26752F21F0@microsoft.com, "Lontae Jones"
<LontaeJones@discussions.microsoft.com> wrote:
> I hava table called Escallation has one column Calls varchar(50). Data is
> inserted into this table from a DTS package. An excel spreadsheet daily.
> When a value of ASAP12 enters this column in this table is it possible to
> have SQL send me an email?
|