• Thanks for your time and pointing out the mismatch. I also changed the statement to local temp tables. I changed the mismatch, but that didn't resolve it.

    Yes, I'm building the file listing this way:

    declare @images nvarchar(max)

    set @images = 'N'''

    declare @current_image nvarchar(max)

    while (select COUNT(*) from #ap_routing) > 0

    begin

    set @current_image = (select top(1) image_file from #ap_routing)

    if (select COUNT(*) from #ap_routing) > 1

    begin

    set @images = @images + '\\waccounting\ffwin\images\vendor\ap invoice\' + @current_image + ';'

    end

    else

    set @images = @images + '\\waccounting\ffwin\images\vendor\ap invoice\' + @current_image + ''''

    delete from #ap_routing where image_file = @current_image

    end

    and I am doing a select @images right before the send_ dbmail command so I can see that I'm building the list right. Again, when I copy the output of that select statement and paste it into my @file_attachments line (replacing the @images with what @images contains), it works. It is baffling and I've searched for solutions and I haven't seen any given yet. I figured I would try posting again up on this board.

    select @images

    exec msdb..sp_send_dbmail @profile_name = 'mail account',

    @recipients = 'gbankos@worthandcompany.com',

    --@copy_recipients = 'gbankos@worthandcompany.com',

    --@copy_recipients = 'lnelson@worthandcompany.com',

    @subject = 'Invoices needing your approval',

    @body = @body,

    @body_format = 'HTML',

    @execute_query_database = forefront,

    @file_attachments=@images