简体   繁体   English

如何在SSRS中以文件名扩展名为.txt的csv文件?

[英]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. 该报告呈现为csv。 the file name comes as MyReport1234. 文件名为MyReport1234。 csv . csv

I need this to be Myreport1234. 我需要这个是Myreport1234。 txt . txt How can I do this in SSRS? 如何在SSRS中执行此操作?

I use SSRS 2008 R2 btw 我使用SSRS 2008 R2 btw

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步中,只需编写SELECT 1或者如果您尝试生成动态文件,则可以将其逻辑嵌入到select语句中,并为其提供别名,例如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上,指定一个静态文件名,或者使用在上一步中创建的“ FileName”列从数据库中获取值。
  4. set the Render Format to CSV 渲染格式设置为CSV
  5. This is the important step >> File Extension must be set to False . 这是重要的步骤>> 文件扩展名必须设置为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. 将文件名上的所有内容保留为文件扩展名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM