简体   繁体   English

将数据导出到具有NText数据类型SQL Server的CSV

[英]Export data to csv having datatype ntext SQL server

I want to export data from SQL server to CSV format but having issue with ntext dataype in some tables columns. 我想将数据从SQL Server导出为CSV格式,但某些表列中的ntext dataype出现问题。

data is ntext column is html with html tags like br , li etc.. 数据是ntext列是html,带有br,li等html标签。

BRANDS SUBSECTION:BEAUTY, FRAGRANCE, GROOMING & HEALTH
Acticare
abc def PR
abc def T: 020-0000 1230 e: abc@abc.com

Added Dimension Dentistry
abc def PR
abc def T: 012-3456 7689

I have tried export from SQL server direcly exporting to csv format , tried SSIS package,even tried converting to varchar then export but when exported data is not showing correctly. 我尝试从SQL Server直接导出为csv格式导出,尝试使用SSIS包,甚至尝试转换为varchar然后导出,但是导出的数据显示不正确时。

How do I export data to excel/csv having column data type ntext containing html tags ?? 如何将数据导出到具有包含html标签的ntext列数据类型的excel / csv?

When you are selecting the columns in the CSV file destination, try setting the Data Type for the source column to 在CSV文件目标中选择列时,请尝试将源列的数据类型设置为

text stream [DT_TEXT] or Unicode text stream [DT_NTEXT] (as the case maybe). text stream [DT_TEXT]Unicode text stream [DT_NTEXT] (视情况而定)。

在此处输入图片说明

I'm using SQL Server Export Wizard. 我正在使用SQL Server导出向导。 In the choose destination be sure to use a Delimited Format with a double quote text qualifier. 在选择目的地中,请确保使用带双引号文本限定符的定界格式。

Cast the column in the select statement CAST([Message] as NVARCHAR(255)) as Message (Message is defined as ntext) 将选择语句CAST([Message]中的列转换为NVARCHAR(255))作为Message(将消息定义为ntext)

Use a comma delimiter 使用逗号分隔符

...then map to DT_NTEXT in the export wizard ...然后在导出向导中映射到DT_NTEXT

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

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