Created
May 14, 2013 10:55
-
-
Save badmotorfinger/5575139 to your computer and use it in GitHub Desktop.
Formats all SQL scripts in a directory using a free webservice provided by tsqltidy.com and PowerShell.
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
$uri = 'http://www.tsqltidy.com/SQLTidy.asmx' | |
$proxy = New-WebServiceProxy -Uri $uri -class FormatSQL -Namespace FormatSQL | |
#Warning - Will format file contents and overwrite the original file. Use with caution. | |
gci *.sql | % { $content = $proxy.ParseSQL((get-content $_.FullName)); Set-Content $_.FullName $content; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment