Sql Server database table export issue using BCP utility and database table contains "HTML ELEMENTS"

StackOverflow https://stackoverflow.com/questions/19175852

  •  30-06-2022
  •  | 
  •  

Question

In have been using the bcp utility to export my sqlserver database table(contains HTML elements in cells) using the command below:

C:>bcp "select * from dbName.dbo.TableName" queryout c:\bcpexport.xls -c -k -SServerName -U sa -P 111

However export is successful but the rows are messed up if some column contain HTML tags/elements. This is a serious problem I am facing since this results error while importing this excel to my MySql database.

Below is screenshot of the excel with messed up rows/cols.

Any help/support is highly appreciated.

Was it helpful?

Solution

You may want to try adding the Unicode Character Format flag, -w, to your bcp. It should help with character encoding issues, even if your data types are not unicode.

•if the source and destination data are not Unicode data types, use of Unicode character format minimizes the loss of extended characters in the source data that cannot be represented at the destination.

http://technet.microsoft.com/en-us/library/ms188289.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top