Thursday, March 8, 2012

Check and send data with xp_sendmail

How yould i loop trought all the records in a table and fetching a specic record that is flagged and sending for each record found a email with that records data to a mail recipient. this should be part of a step in a sql job. PLZ HELPHad a little problem in understanding your phrases. You may check cursor in BOL for looping actions.|||create proc abc as
declare c1 cursor as select primary key from table name where condition
open c1
while (@.@.fetch_status =0)

begin
exec xp_sendmail ....
fetch next
end

something like this and schedule as job !!!

No comments:

Post a Comment