venuchalla
Programmer
Hello,
I am having a stored procedure through which I am sending an email using xp_sendmail and then updating a record in the database.
The update works fine but I am not able to receive the email from the stored procedure.
Could you please help me to receive the email from this stored procedure...
This is the stored procedure..
BEGIN
SET NOCOUNT ON
declare @CreatedByAlias varchar(50),
@expireat datetime,
@mailsent char(3),
@status varchar(10)
declare cur CURSOR for
select CreatedByAlias,expireat,mailsent,status
from Issues
where status = 'Open' and
DateDiff(minute,getdate(),expireat) = 30 and
mailsent ='No'
open cur
fetch next from cur into @CreatedByAlias,@expireat,@mailsent,@status
while @@FETCH_STATUS = 0
BEGIN
exec master.dbo.xp_sendmail @recipents=@CreatedByAlias,
@message=N'Reminder !!! This issue should be closed with in 30
minutes.' ;
Update Issues set mailsent ='Yes'
where CreatedByAlias = @CreatedByAlias and
expireat = @expireat and
mailsent = @mailsent and
status = @status
fetch next from cur into @CreatedByAlias,@expireat,@mailsent,@status
END
close cur
deallocate cur
------
Thanks in advance
I am having a stored procedure through which I am sending an email using xp_sendmail and then updating a record in the database.
The update works fine but I am not able to receive the email from the stored procedure.
Could you please help me to receive the email from this stored procedure...
This is the stored procedure..
BEGIN
SET NOCOUNT ON
declare @CreatedByAlias varchar(50),
@expireat datetime,
@mailsent char(3),
@status varchar(10)
declare cur CURSOR for
select CreatedByAlias,expireat,mailsent,status
from Issues
where status = 'Open' and
DateDiff(minute,getdate(),expireat) = 30 and
mailsent ='No'
open cur
fetch next from cur into @CreatedByAlias,@expireat,@mailsent,@status
while @@FETCH_STATUS = 0
BEGIN
exec master.dbo.xp_sendmail @recipents=@CreatedByAlias,
@message=N'Reminder !!! This issue should be closed with in 30
minutes.' ;
Update Issues set mailsent ='Yes'
where CreatedByAlias = @CreatedByAlias and
expireat = @expireat and
mailsent = @mailsent and
status = @status
fetch next from cur into @CreatedByAlias,@expireat,@mailsent,@status
END
close cur
deallocate cur
------
Thanks in advance