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 2005 Forums
 Transact-SQL (2005)
 No clue how to run a job

Author  Topic 

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2009-04-08 : 14:06:39
I have 2 tables that a seperate application adds data to. The application writes emails to the tables so I can make a job to send them every morning at 3am

Table 1 BatchEmailSchedule
batchID
batchName
emailDate

Table 2 BatchSchedule
ID
batchID
emailAdd
emailSubject
emailBody
emailFrom

So what I need to do is run this everyday at 3 if the date = emailDate then send all emails in the BatchSchedule table.. then delete them.

I have no idea even how to start this. Is there an example somewhere?

Dave
Helixpoint Web Development
http://www.helixpoint.com

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-04-08 : 14:13:46
1. Create a Stored procedure
2. In your SQL server create a job under the SQL Server Agent|Jobs node. Righ Mouse Click then select New Job
3. Give it a name, the rest is pretty easy
4. In Steps in Select a page (Far right), Select New...it should default to T_SQL. In there do EXEC [your stored procedue from step 1]

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -