Get-ChildItem C:\SomePath -recurse | Where-Object {$_.get_Extension() -eq ".sql"} |foreach {Write-Output "Executing: " $_.FullName; osql -S SqlServerName -d DatabaseName -i $_.FullName -E} > c:\SomeFileToPipeOutputTo
TODO: redo to use sqlcmd as osql is not recommended anymore for the sql 2005
No comments:
Post a Comment