Dear Lumbago,I did this T-SQL:DECLARE @p_body as nvarchar(max), @p_subject as nvarchar(max)DECLARE @p_recipients as nvarchar(max), @p_profile_name as nvarchar(max)DECLARE @xml NVARCHAR(MAX)SET @p_profile_name = N'Birthday Wish Admin'SET @p_recipients = (SELECT Stuff((SELECT N'; ' + [email] FROM [dbo].[todayBday] FOR XML PATH(''),TYPE).value('text()[1]','nvarchar(max)'),1,2,N''))SET @p_subject = N'Wish You a Very Happy & Prosperous Birthday'SET @p_body = '<p style="text-align: center;"><span style="color:#ff0000;"><strong><span style="font-size: 22px;">Wish YOU a very Happy & Prosperous Birthday</span></strong></span><span style="font-size:20px;">May the sun#39;s rays shine brightest on you today with the wind at your heals.</span><span style="font-size:20px;">Happy Birthday.</span>'EXEC msdb.dbo.sp_send_dbmail @profile_name = @p_profile_name, @recipients = 'admin@xyz.com', @blind_copy_recipients = @p_recipients, @body = @p_body, @body_format = 'HTML', @subject = @p_subject
I paste the following T-SQL in JOB.quote:
Originally posted by Lumbago
Pseudo code:DECLARE CURSOR cur FOR SELECT ... FROM todayBday open curFETCH NEXT FROM cur INTO ..., @Emailwhile (@@fetch_status = 0) begin EXEC msdb.dbo.sp_senddbmail ..., @Email FETCH NEXT FROM cur INTO ..., @Email endclose curdeallocate cur
- LumbagoMy blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/