I need to read a folder and process different formatted (csv) files and load to SQL table. THe file format of one
of the csv looks like this:
(1) (2) 3 4 5 6
02-06-2013,10:08:57,0,0,120,30306
02-06-2013,10:09:57,0,4,120,30306
I need to combine column 1 and 2 and make a datetime. Then take column 3 and 6(first 3 postions) and write record to SQL. I need to create multiple records for the SQL write. The record write to SQL table would be COl1and2 combined then hard
coded value (001) then value from col 3 then col 6 first 3 positions. Then I need to repeat that same write to SQL for col 4 but use hard coded (002). Then repeat that same write to SQL for col5 with hard coded value(003). I need to write 3 records to
SQL from that one record. The hard coded values are different tests based upon record pos(3,4,5). Pos 3 is always (001) TEST ... Pos 4 is always(002) and Pos 5 is always(003). I would like at the end of reading the input give a small log of file processed
and records read and written. I have used PS to load a CSV to SQL before but not with this kind of logic more of a straight load. Thanks.
↧
load csv file to sql table
↧