UPD 3 756 20180502 Y | A 对于第3部分,最后一列的值显示为X | A。 任何帮助将不胜感激。在此先感谢。 问候, GopinathI have a '|' delimited Flat file with varying columns in 3 different sections.Each section is identified by the value in the second column.I have to read this file and load it in a table through SSIS.It would be better if someone provides a solution for it.Please find the below mentioned sample dataSample data:UPD|1|123|20180502|JOHN|20180502UPD|1|345|20180502|PETER|20180502UPD|2|456|20180502|X|AUPD|2|912|20180502|Y|AUPD|3| |257|20180502|X|AUPD|3| |756|20180502|Y|AIf you notice the 3rd section has got an extra column. In section 3 alone we have got 7 columns but in rest of the section we have only 6 columns.I need a output like this:UPD112320180502JOHN 20180502UPD134520180502PETER 20180502UPD245620180502X AUPD291220180502Y AUPD3 257 20180502X AUPD3 756 20180502Y AWhat I have tried:If i read this file through file_file_source in ssis the data is coming like this, the flat file is considering only the 6 columns and for the section 3, 7th column value is displayed in 6th column itself.UPD112320180502JOHN 20180502UPD134520180502PETER 20180502UPD245620180502X AUPD291220180502Y AUPD3 257 20180502X|AUPD3 756 20180502Y|AFor section 3 the last column value is displayed as "X|A".Any help would be greatly appreciated. Thanks in advance.Regards,Gopinath推荐答案你好Gopinath, 这是一个老问题,所以你可能已经在其他地方找到了答案。如果没有,请查看我关于动态列映射的文章: SSIS中的动态文件列映射。 - SQLServerCentral [ ^ ] 我的解决方案处理平面文件中的变量列,其中所有行的值与文件中的列数相同。但是,在我的解决方案中使用的脚本组件中,很容易实现代码更改,以便在读取数据时处理行与行之间的任何差异。 此致, HiskeHi there Gopinath,It's an old question, so you might have already found an answer elsewhere. If not, take a look at my article on dynamic column mapping: Dynamic File Column mapping in SSIS. - SQLServerCentral[^]My solution deals with variable columns in flat files where all rows have the same number of values as there are columns in the file. However, in the Script Component used in my solution, it's easy to implement code changes to handle any differences from row-to-row as the data is being read.Regards,Hiske 这篇关于需要导入具有不同部分的平面文件,其中包含不同的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-13 04:30