Wednesday, March 7, 2012

copy content of a text file into table

Hi Guys,

What approach should I use to copy content of a text file.

Example of the text file's content:

Date, "20060101"
ST_Code, "101"
A_Code, P_Code, T_Code, amount, price
"0001", "1111", "0101", 550, 230
"0002", "1111", "0102", 345, 122
"2001", 0212", 0930", 410, 90

In the example above, I just want to copy the rows Date, "20060101" and ST_Code, "101" into a table.

Regards,

Lars

Hi Larry,

If the text file is not very large, in that scenario you can simply iterate through the file line by line checking for those lines which contain your desired content. Extract the content and fire and insert against the table.

I am feared that you may not be able to find any ready-made solution for it.

|||

Larry Surat wrote:

Hi Guys,

What approach should I use to copy content of a text file.

Example of the text file's content:

Date, "20060101"
ST_Code, "101"
A_Code, P_Code, T_Code, amount, price
"0001", "1111", "0101", 550, 230
"0002", "1111", "0102", 345, 122
"2001", 0212", 0930", 410, 90

In the example above, I just want to copy the rows Date, "20060101" and ST_Code, "101" into a table.

Regards,

Lars

Read the file in as a single-columned dataset. Use Conditional Split to get only the rows you are interested in. Then use Derived Column to parse out all of the columns.

-Jamie

No comments:

Post a Comment