Basic script to import every .CSV file from a directory and INSERT each one into it's own table in SQL Server. It will create the table if it doesn't exist.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|dir -Filter *.csv ||
|,(Import-Csv -Path $_.Name) ||
|Write-SqlTableData -ServerInstance localhost\SQL2017 -DatabaseName BlankDB -SchemaName dbo -TableName $_.BaseName -Force|