Created
January 25, 2017 14:18
-
-
Save bymyslf/b79d1dd2d33979cf2c697f19f38370ca to your computer and use it in GitHub Desktop.
Run SQL Scripts via PowerShell and SqlCmd utility
This file contains hidden or 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
| param | |
| ( | |
| [String]$Path, | |
| [String]$Server, | |
| [String]$Database | |
| ) | |
| $sqlCmdUtil = "C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SQLCMD.EXE" | |
| Get-ChildItem $Path\*.sql | Sort-Object -Property Name | % { & $sqlCmdUtil -S $Server -d $Database -i $_.FullName -t 750 -l 600 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment