Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Sending a mail when inserting a row to a table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-06 : 08:01:55
vijay writes "Sir,

I am using sql server 2000 and a GUI environment to access the database in that server.

My problem is,
If I insert one row into a table with the name field contains 'abc', then a mail has to automatically send to that abc person. How to do it.

I referred your article named 'Sending SMTP Mail using a Stored Procedure'(http://www.sqlteam.com/item.asp?ItemID=5003). I copied that code and created the procedure in my database, but if execute it with valid data, it is not sending any mail.

How to use it?
In that you have mentioned MailServer as 'localhost'. Whether I have to change it, if it so then what to give as MailServer name.

System Configuration:-
---------------------
I am using a windows 2000 client and SQL Server 2000 is present in our windows 2000 server. We also have separate mail server.

Expecting your reply soon

Thanks in advance,
Vijay"

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-05-06 : 08:34:28
I don't think I get u'r question properly but I think u will have to have a trigger on the table which will send the mail to the specified person

Expect the UnExpected
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-05-06 : 12:20:02
I'm confused as well.

Do you already having SQLMail setup on your database server? If not, then set it up. Then you will want to create a trigger as harshal_in mentioned that fires when an insert happens and sends an e-mail to the appropriate person using xp_sendmail.

HTH,

Tara
Go to Top of Page
   

- Advertisement -