Search code examples
csvreporting-servicesssrs-2008-r2ssrs-subscription

How do I create a csv file in SSRS with a .txt extension in the file name?


I have a report where I have added a data driven subscription that writes the report to a folder location on a daily schedule. The report is rendered as csv. the file name comes as MyReport1234.csv.

I need this to be Myreport1234.txt. How can I do this in SSRS?

I use SSRS 2008 R2 btw


Solution

  • found a solution for this:

    1. Create a data driven subcscription
    2. on Step 3, just write SELECT 1 or if you're trying to generate a dynamic file you could embed the logic for this in your select statement and give it an alias like SELECT 'Myreport1234.txt' as [FileName]
    3. on Step 4, either Specify a static file name, or get the value from the database using the column "FileName" which you created in the previous step.
    4. set the Render Format to CSV
    5. This is the important step >> File Extension must be set to False. This will stop the renderer from adding the default extension for the renderer of your choice. leaving whatever thats on the filename to appear as the file extension.