首页 文章

SSIS:导出和导入带有特殊字符的CSV文件

提问于
浏览
0

我必须使用SSIS从数据库导出CSV文件 .
它's very easy to do that, but the problems come when I have to import the same CSV file into another database (from another server) because I have 2 columns which contains characters like: comma (,), apostrophe ('),分号(;),冒号(:),竖线(|) . 我不知道哪个应该是平面文件连接的设置,它应该是 Headers 行分隔符,行分隔符,列分隔符...以便同时执行这两个操作(导出然后导入) .

我尝试了很多组合,但我仍然遇到如下错误:

[平面文件源[2]]错误:数据转换失败 . “ActiveJobs”列的数据转换返回状态值2和状态文本“由于潜在的数据丢失,无法转换该值 . ” . 由于字符和空格,数据在那里混合 .

1 回答

  • 0

    在SSIS中,您可以选择为平面文本文件指定文本分隔符\限定符 . 您可以使用它来导出具有特殊字符的列 . 例如,如果您的行如下所示:

    column1value co,lumn2value co;lumn3value

    然后使用' , ' as the column delimiter and ' " '作为文本分隔符的导出行看起来像 "column1value","co,lumn2value","co;lumn3value"

    我不记得如果你有像 co"lumn4value or "column4value" 这样的值会发生什么

    但我认为如果你有双引号的问题,你可以使用任何字符作为分隔符作为文本分隔符 . 例如'•'(alt 0149)

相关问题