开发者

How to control range of rows while loading csv file into sqltable using ssis

开发者 https://www.devze.com 2023-03-05 02:35 出处:网络
I have a csv file.The format of csv file is something like this: [Asrcdt] [col1 col2 col3 col4 col5] [12345]

I have a csv file.The format of csv file is something like this:

[A    src   dt]
[col1 col2 col3 col4 col5]
[1     2    3     4    5]
[1     2    3     4    5]
[n     n    n     n    n]
[z    src   dt]

I want to load data up to n row.I don't want the last row. I can skip the first row in flate file connection manager ed开发者_C百科itor.But how can i skip the last row while inserting data into sqltable.

Thanks in advance, David


You could put all the rows into a staging table in your DB, then use some T-SQL to move all but the last row into the recipient table.

You could probably do something with a script transformation in your dataflow to do what you ask solely using SSIS, but it would be a lot more work than the above staging table method.


That is the job for the Script Task:) Write a simple c#/VB script that checks whether it's the last row in the flow (hasMoreRows i think is the property) and redirect row to appropriate output (or simply eat it:)

Luke

0

精彩评论

暂无评论...
验证码 换一张
取 消