SSIS Send email Task With Variables -


i asked send email employees following info have:

excel file (employeeinfo):

empid   empname rank    promogift 1       peter       5       1 2       armand      4       2 3       tommy       5       5 4       sarah       2       4 5       maria       3       3 

csv file (promocode):

promoid validation 1       1 2       0 3       1 4       1 5       0 

text file (promoinfo)

promoid gift 1       100$ apple gc 2       80$ apple gc 3       60$ apple gc       4       40$ apple gc     5       20$ apple gc 

requirements:

1. employees has validation = 1 receive gift. 2. gift based on promoid (promogift) 3. "data flow task, execute sql task, foreach loop & send mail" task can used execute task above. 4. in email, need replace [...] accordingly. 5. employee's email neglect in exercise.  

i send email them following message:


dear [empname],

this [currentyear], during our [eventname], have been selected winner reaching next level rank [rank]. receive [gift]!

a gift manager [manager]!

congratulation!


what should (i new ssis)?

create 3 data flow task , load each files sql server table. use sql task join, can list of receive gift, what's next? , should use insert variables email template? believe need creates variables too.

any thoughts?

check this.

1.first load each files sql server tables employeeinfo , promocode , promoinfo

2.open sql server , need create profile , account using configure database mail wizard can accessed configure database mail context menu of database mail node in management node. wizard used manage accounts, profiles, , database mail global settings

  1. query send mail

        use msdb     go     exec sp_send_dbmail @profile_name='yourprofilename',     @recipients='test@example.com',     @subject='test message',     @body='this body of test message.     congrates database mail received successfully.' 

4.

declare @email_id nvarchar(450)='1', @id bigint, @max_id bigint, @query nvarchar(1000)  select @id=min(id), @max_id=max(id) [employeeinfo ]    while @id<=@max_id begin     select @email_id=email_id ,@gift =gift     employeeinfo e join promoinfo p on p.id = e.id     id=  @id      set @body =  n''+@email_id+'your gift is' +@gift;      set @body = @body      exec msdb.dbo.sp_send_dbmail     @profile_name = 'profile_name',     @body = @body,     @body_format ='html',     @recipients = @email_id,     @copy_recipients = '',     @subject = 'subject' ;      select @id=min(id) [employeeinfo ] id>@id  end 

you can use these example , create sp that. , call sp in ssis package.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -