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
 Transact-SQL (2000)
 execute bulk procedure

Author  Topic 

blackX
Posting Yak Master

102 Posts

Posted - 2009-10-07 : 13:18:01
I have a procedure that sends an email from the database. The email itsself varies on content and depends on the data related to who the email was sent to. I would like to expand this a way to execute this procedure in an sql job, and for everyone based on a query form the database. Any help would be great.

Thanks in advance

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-07 : 16:14:43
You can use SQL Mail inside a SQL Server job. There are also other solutions out there, but I've always had an Exchange server so SQL Mail is what we went with. If you have a more specific question, then please do ask.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

blackX
Posting Yak Master

102 Posts

Posted - 2009-10-07 : 18:18:05
I have a stored procedure that executes based on a single parameter (@member_id). I need to exectute this stored procedure on 100+ records daily. I would like to automate this process.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-07 : 18:56:40
SQL Mail allows you to execute queries including stored procedures.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

blackX
Posting Yak Master

102 Posts

Posted - 2009-10-07 : 18:58:30
My problem was not sending the email, that was already working. I needed to execute the procedure that did the email on a list of people. I got the functionality I needed with a cursor.

Thank you
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-07 : 19:01:07
Sorry I didn't see that asked in the thread, so I assumed you were asking about the email capabilities of SQL Server. Yes you'd need to use a cursor or a loop to achieve the functionality you desire if your stored procedure can't be altered.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

blackX
Posting Yak Master

102 Posts

Posted - 2009-10-07 : 22:00:48
yeah I didnt want to alter the proc becuause it is used in other places. I don't know why i didnt think of a cursor in the first place. thanks for your help anyway.

travis
Go to Top of Page
   

- Advertisement -