I’m currently importing a csv file and inserting some of the results into a table.
Unfortunately I’m using Sqlcmd, but the module isn’t installed on the relevant server and can’t be installed (out of my control).
Is there a way to manage the exact same as the below, outside of SqlCMD?
Example Code:
$server = 's'
$database = 'd'
$table = 't'
Import-CSV C:\Test\Test.csv | ForEach-Object {Invoke-Sqlcmd `
-Database $database -ServerInstance $server `
-Query "INSERT INTO $table VALUES ('$($_."Column One")',
'$($_."Column Two")',
NULL,
'$($_.""Column Three"")')"
}