• a rough example of multiple recipients from a query, unique emails, same attachment:

    declare

    @isql varchar(2000),

    @email varchar(64)

    declare c1 cursor for select distinct email FROM DatabaseName.dbo.SomeTable WHERE CampaignID = 42 and dbo.IsValidEmail(email) = 1

    open c1

    fetch next from c1 into @email

    While @@fetch_status <> -1

    begin

    declare @body1 varchar(4000)

    set @body1 = 'Latest documentation For You. ' + CONVERT( VARCHAR( 20 ), GETDATE(), 113 ) +

    ' '

    EXEC msdb.dbo.sp_send_dbmail @recipients=@email,

    @subject = 'Latest documentation ',

    @body = @body1,

    @body_format = 'HTML',

    @file_attachments = 'c:\ServerAttachments\ERP.pdf'

    fetch next from c1 into @email

    end

    close c1

    deallocate c1

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!