$database = 'foxdeploy' $server = '.' $table = 'dbo.powershell_test' Import-CSV .yourcsv.csv | ForEach-Object {Invoke-Sqlcmd ` -Database $database -ServerInstance $server ` -Query "insert into $table VALUES ('$($_.Column1)','$($_.Column2)')" }
引用:https://stackoverflow.com/questions/29539179/how-to-import-data-from-csv-in-sql-server-using-powershell