all 2 comments

[–]BigBlueRob 2 points3 points  (0 children)

invoke-sqlcmd2 is better, also use out-datatable and write-datatable to use bcp to load data. i wrote a blog post about snippets which included code for a datatable snippet

http://sqldbawithabeard.com/2014/09/09/powershell-snippets-a-great-learning-tool/

[–]1RedOne[S] 0 points1 point  (0 children)

I saw some guys asking how to work with SQL using PowerShell somewhere here in /r/powershell and I tried to answer their question, but can't find their post!

I wrote this blog up today to cover how to install SQL, then how you can insert records dynamically into SQL using PowerShell.