Exporting Report to CSV

J_Fig 1 Reputation point
2022-05-19T18:14:14.863+00:00

Hi,

I'm using Report Builder 3.0 with an imbedded script to generate a report for client in CSV format for input purpose. The SQL script gathers the desired data, inserted into a temp table and "creates" a new column with is the concatenation of some columns, like this:

Blockquote

SELECT T1.A,T1.B,T1.C,T1.D,[Delimited Row]=CONCAT(T1.A,",",T1.B,",",T1.C,",",T1.D) INTO #T2 FROM T1

Blockquote

. This [Delimited Row] is the only row used in Report Builder, the column header was deleted and works just fine. The problem I'm having is that when exported as CSV and opened in Notepad (example file attached and image below), I'm seeing the textbox's name as first row and each row under it is double quoted. I've tried changing the DataElement Output property to NoOutput at the textbox level, putting the column header back and setting the column header DataElementOutput property to NoOutput and the textbox's property to Output or Auto but still see the Delimited_Row text as first row. I also want to get rid of the double quotes qualifier but no success either. Can anyone help with this?

Thanks in advance!

203740-csv-example.txt

203776-csv-example.png

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,815 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Isabellaz-1451 3,616 Reputation points
    2022-05-20T02:19:46.537+00:00

    Hi @J_Fig
    When I have a table like below:

    203932-image.png
    the export csv is:
    203866-image.png

    So the comma is the separation between these fields.

    If your field already has this comma, then another separator is required between the fields, so that the double quotes come out.

    Maybe you can change the “,”to “|” ,then take a look at the export csv.

    Here is my test dataset QUERY STATEMENT:

    SELECT [Delimited Row]=(T1.A+'|'+T1.B+'|'+T1.C+'|'+T1.D) FROM TEST1 T1

    EXPORT CSV:

    203938-image.png

    And about the column header ,I think there is no other way unless you delete it manually

    Best Regards,
    Isabella


    If the answer is the right solution, please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments