我的数据类似于以下内容:
"D.STEIN","DS","01","ALTRES","TTTTTTFFTT"
"D.STEIN","DS","01","APCASH","TTTTTTFFTT"
"D.STEIN","DS","01","APINH","TTTTTTFFTT"
"D.STEIN","DS","01","APINV","TTTTTTFFTT"
"D.STEIN","DS","01","APMISC","TTTTTTFFTT"
"D.STEIN","DS","01","APPCHK","TTTTTTFFTT"
"D.STEIN","DS","01","APWLNK","TTTTTTFFTT"
"D.STEIN","DS","01","ARCOM","TTTTTTFFTT"
"D.STEIN","DS","01","ARINV","TTTTTTFFTT"
我使用平面文件源编辑器加载数据。删除所有双引号的最简单方法是什么?
答案 0 :(得分:18)
进一步搜索显示我应该使用平面文件来源的Text Qualifier
标签上的 General
。
在Notepad ++中查看时的平面文件内容。 CRLF
表示这些行以Carriage Return
和Line Feed
结尾。
在平面文件连接管理器上,在 Text qualifier
文本框中输入双引号。
设置文本限定符后,数据将被正确解析并显示如下:
答案 1 :(得分:0)
在使用双引号和逗号加载CSV时,有一个限制是添加了额外的双引号,并且数据也附加了双引号,您可以在源文件的预览中查看。 因此,添加派生列任务并给出以下表达式: -
(REPLACE(替换(正确(SUBSTRING(TRIM(COL2),1,LEN(COL2) - 1),LEN(COL2) - 2),“”,“@”), “\”\“”,“\”“),”@“,”“)
粗体部分删除用双引号括起来的数据。
试试这个并告诉我这是否有用
答案 2 :(得分:0)
substring([column 5], 2,(len([column 5])-2) )
答案 3 :(得分:-1)
我宁愿使用以下声明......
REPLACE(REPLACE(REPLACE(CoulumnName,'""','[YourOwnuniqueString]'),'"',''),'[YourOwnuniqueString]','"')
注意:请确保您的YourOwnuniqueString
应该是唯一的,并且不会在列中的任何位置用作数据。 E.x:SQL@RT2#myCode
- 区分大小写 -