hi every one,
iam a newbie in .net,i have a application in which i have to send email using triggers.can any one plz help, on how to configure sql mail .my application needs to delete rows on completion of expiry date and send the administrator email notifying it.
ok waiting for reply
bye
hi,
i want to elaborate wat exactly i want.trigger executes only after update or insert or delete occurs.i want to know how to delete rows even if the administrator didnt update or insert or didnt touch the datebase for few days,then aslo we should be able to delete rows and mails should be sent notifying the administrator about deleting rows.
my code is like this
CREATE TRIGGER [trg_job] ON [dbo].[JobPost]
FOR INSERT, UPDATE, DELETE
AS
set nocount on
declare @msg varchar(2000),
@postingdate nvarchar(50),
@applydays nvarchar(30),
@jobexpirydate nvarchar(30)
declare email_cur CURSOR
for
select postingdate,applydays,jobexpirydate from jobpost
where jobexpirydate = dateadd(dd, 2,getdate())
open email_cur
fetch next from email_cur into @postingdate, @applydays, @jobexpirydate
while @@Fetch_status=0
begin
set @msg='Dear row will be deleted'
exec master.dbo.xp_sendmail @recipients='xxx@yyy.com', @message=@msg,
@subject='delete Notification'
fetch next from email_cur into @postingdate, @applydays, @jobexpirydate
end
deallocate email_cur
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.