我正在使用带有平面文件连接管理器的SSIS包,如下图所示,格式为:分隔符和文本限定符为&#34; 。所有列都是逗号分隔。但是,我的表格中有一列 ItemDescription ,其中包含 Box Dimension 2&#34; 等数据,而不是 Box Dimension 2 in。或<例如,强>箱尺寸2英寸。这导致生成的csv文件在我的包中点击该piont时创建另一列。关于如何在没有获得另一个专栏的情况下完成这项工作的任何建议?
[]
更新,以下是文本文件的原始数据作为输出,此处的示例是 SupplyID 929,带有ItemDescription&#34; Box Fiberboard 2&#34;&#34;。还供应ID 525和888
"SupplyID","ProtocolName","AssayName","ItemNumber","ItemDescription","PackagingUnits","SupplyCost","CatalogNumber","SetChildItemsToInclude","PrimaryStatus","SecondaryStatus"
"1531","XXXXXX","XXXXXX XXXXXX","XXXXXX-XXXXXX","XXXXXX XXXXXX: XXXXXX A (100% XXXXXX XXXXXX) and B (80% XXXXXX XXXXXX + 20% DMSO)","1","0","BD368632","","False","False"
"368","XXXXXX","XXXXXX XXXXXX","XXXX001","XXXXXX XXXXXX","250","0.16","STP-150","","False","False"
"369","XXXXXX","XXXXXX XXXXXX","XXXX002","XXXXXX XXXXXX","100","0.03","326895","","False","False"
"370","XXXXXX","XXXXXX XXXXXX","XXXX003","XXXXXXXXXXX, 20 G (Insyte)","50","3.39","BD 381433 ","","False","False"
"371","XXXXXX","XXXXXX XXXXXX","XXXX004","XXXXXXXXXXX, 22 G (Insyte)","50","3.39","BD 381423","","False","False"
"372","XXXXXX","XXXXXX XXXXXX","XXXX006","XXXX XXXX XXXXXXXXXXX (BD)","200","1.09","BD 364880","","False","False"
"929","XXXXXX","XXXXXX XXXXXX","XXXX007","Box Fiberboard 2"","1","5.41","","","True","False"
"525","XXXXXX","XXXXXX XXXXXX","XXXX126","Parafilm M XXXXXX, 2" x 250 feet (Ref# PM992), 1 XXXXXX Each","1","42.12","13-374-16","","False","False"
"888","XXXXXX","XXXXXX XXXXXX","XXXX152","XXXXXX XXXXXX, 21G w/12" XXXXXX, XXXXXX lock","50","1.65","","","False","False"
答案 0 :(得分:0)
选项#1 临时修复将文件转换为管道“|”分隔。
选项#2 在列值中用双引号“part1,part2”逗号括起所有列。在你的情况下“Box Dimention 2,boxkalai”。
答案 1 :(得分:0)
如果不查看原始数据,很难确切地说出错误是什么。在屏幕截图中,最重要的字符被删除(例如,
和"
)。
如果您可以提供部分原始数据,我们将能够为您提供更好的帮助。 (例如:某些字段也可以是多行)
但是我的表格中有一列ItemDescription,其中包含Box Dimension 2&#34;例如,而不是Box Dimension 2 in。或Box Dimension 2英寸。这导致生成的csv文件在我的包中点击该piont时创建另一列。
由于字段中的额外,
没有被引号正确包围,因此那些额外的列几乎可以存在。
一些一般规则:
当字段内有分隔符时,(仅)需要引号。如果某个字段被引号括起来,则该字段中的引号必须使用其他引号进行转义 - 例如:"27"" monitor, black"
。
如果flatfile确实格式错误,则永远不会被接受,因为从长远来看这只会带来更多麻烦。唯一的权利&#39;在这种情况下,解决方案是“需求”。提供良好数据的数据提供者。
尝试修复&#39; (导入)格式错误的平面文件不仅会给长期带来更多麻烦(特别是在数据定期更新的情况下),而且还会使越来越多的格式错误的数据浮出水面(如果商城提供商知道它得到了固定的,他们可能不愿意自己解决它。)
编辑(现在查看原始数据)
我查看了原始数据,实际上数据格式不正确:
,"Box Fiberboard 2"",
应为,"Box Fiberboard 2""",
和,"Needles Butterfly, 21G w/12" tubing, luer lock",
应为,"Needles Butterfly, 21G w/12"" tubing, luer lock",
。
所以,理想情况下,这些数据应该在源头固定。
如果无法做到这一点,可能会出现某种类型的黑客攻击(但不推荐),即在","
上拆分行 - 因为所有字段都被引用,你可以躲开它,但你会必须修剪剩余的"
的第一个和最后一个字段。