sp_send_dbmail and mail merge documents

I am using the sp_send_dbmail stored procedure to create my emails from SQL.  I know have  a requirement to send out merge documents that have been created and used in the past.  Now they want me to try and create the mail merge word docs and send them out as attachments with my emails which are created from sp_send_dbmail.  Any ideas on the best method?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark WillsTopic AdvisorCommented:
Well, it is actually word that does the mail merge piece so think you are really going to struggle to get word to merge individual documents to pass back to you so you can mail them out.

You can create various objects to invoke the mail merge and you could control that from SQL, but combining them with your existing emails is again, very difficult.

I am currently scratching my head trying to think if it is even possible. At this point I am inclined to think it is not possible to do it the way you are asking.

Essentially, you have to create the document, and then tell dbmail what (and where) the attachment is...

Have a look at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q285176 and http://support.microsoft.com/kb/258512/ as a couple of ideas. Each time you will notice that word is really controlling it.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.