question

JFig-5008 avatar image
0 Votes"
JFig-5008 asked Isabellaz-1451 edited

Exporting Report to CSV

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
csv-example.png (4.7 KiB)
csv-example.txt (118 B)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Isabellaz-1451 avatar image
0 Votes"
Isabellaz-1451 answered Isabellaz-1451 edited

Hi @JFig-5008
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.



image.png (1.2 KiB)
image.png (2.8 KiB)
image.png (3.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.