Solved

SQL Server - HTML <BR><BR> corrupting CSV output

Posted on 2013-06-03
4
370 Views
Last Modified: 2013-06-03
I have a table that contains a column nvarchar(max) that contains text that includes <BR><BR> in the value.

When I save query results in CSV or Tab delimited format, the rows become corrupt at the <BR> characters.

What are my options for dealing with this? Is there any way to preserve these HTML characters in the CSV output withoiut corrupting the file?

Thanks in advance.
0
Comment
Question by:bobinorlando
4 Comments
 
LVL 15

Assisted Solution

by:gplana
gplana earned 50 total points
ID: 39217536
Apart of the <br> characters, are they any carry return or line feed, i.e. chr(10) or chr(13) characters? If so, just try to remove them.
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 50 total points
ID: 39217802
What are my options for dealing with this? Is there any way to preserve these HTML characters in the CSV output withoiut corrupting the file?
<BR> is just text it cannot "corrupt" your file.
0
 
LVL 16

Accepted Solution

by:
DcpKing earned 400 total points
ID: 39217867
Please show a sample piece of the HTML that you find in the table field, and the resulting piece of CSV file. Also, please try showing the text in the table (and in the resulting CSV file) in Hex format (try using this utility if you don't have an editor like UltraEdit) as some characters that you might possibly be getting into your database field do not show when viewed but do have an effect in a CSV or similar file!

Thanks

Mike
0
 
LVL 1

Author Comment

by:bobinorlando
ID: 39217911
Thanks guys!
It was a char(10) LF character that was embedded in the data which was easier to see in the utility. Thanks for the pointer.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question