How do I change the file name of email attachments | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How do I change the file name of email attachments

We use SQL 2000 report server, pointing to an SQL 2000 database. We have MANY automated e-mail reports that go to our staff on a daily basis. These e-mail reports usually have either an Excel or PDF attachment containing the actual report. We would like to find a way to add the CCYYMMDD to the NAME of the attachment. The e-mail subject line allows adding several parameters for the subject of the e-mail, and there is a limited but usable space for comments as the body of the e-mail, but the attachment is what most concerns us. So, we would like the e-mail, instead of having an attachment named ‘Mikes.XLS’, to have the attachment named ‘20070327Mikes.XLS’. This way, the folks receiving the e-mail can save it on their local system without risking overwriting the report from the day before. And, if at all possible, we would like to NOT have to write custom code in C# or expand our programming staff just to handle this process. (I know this is not the most efficient or ‘proper’ way to do this, but the users have many years of tradition that they are not willing to work around).
You have write a TSQL or VB script (may search on web) to rename the file and then attach using RS. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.