Powershell script to insert new records into a table

We have a folder which every day receives a new CSV file from our remote plants. What we want to do is build a Powershell script that can be run on a schedule from within MS SQL and read these CSV files and insert them into a table. The file names are all the same name, but we need to read only the files we have not read in in the past. 

Are there examples on this site which would help to write this powershell script and could you give examples of what I would use to get this working. I have about a day to get all this working.

No Data
  • I wrote Import-CsvtoSql which could help you. The syntax is as follows:

    Import-CsvToSql -Csv C:\temp\housing.csv -SqlServer sql001 -Database markets -Table housing -Delimiter "`t" 

    That will take care of importing the CSV into SQL, so you'll just have to create the routine that checks to see what's already been processed. To keep track of which files have been processed, you can move the files, rename them, or keep a log in a table.

No Data