Power Shell Script Maybe?
Posted on 2014-04-12
I know BULK is usually the way you upload a csv file into a table but lets just say this is not possible for various reasons. So....
I have aggravatingly played around with a powershell script to create the necessary T-SQL commands to do a INSERT INTO table VALUES (f1,f2,...) (f1,...) What alludes me is doing the foreach on the the records and then the foreach on the values. I know something is not quite right and my only effort so far has resulted in a long line of referencing each field in the $line.whatever.
Nested loops are not that hard of a programming structure so why I can't get it or find an example that shows where I am failing is baffling.