मुझे लगता है कि आप कर्सर के अंदर अपना ईमेल बनाना चाहेंगे -
. की तर्ज पर कुछDECLARE @body nvarchar(max)
DECLARE EmailCursor CURSOR FOR
SELECT checknum, checkamt, email FROM .... -- one row per required email
OPEN EmailCursor
FETCH NEXT FROM EmailCursor INTO @checknum, @checkAmt, @EMAIL
WHILE (@@FETCH_STATUS = 0)
BEGIN
-- do the bit to build email in here
set @body = '<table>'
select @body = @body + '<tr><td>' + docnum + '</td>'
-- .... rest of fields here
+ '<td>'+ Cardcode +'</td></tr>'
from -- ....
where checknum = @checknum -- or whatever gives this context
set @body = @body + '</table>'
exec msdb.dbo.sp_send_dbmail -- ...
FETCH NEXT FROM EmailCursor INTO @checknum, @checkAmt, @EMAIL
end