Skip to content

Instantly share code, notes, and snippets.

@flakey-bit
Created August 30, 2018 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flakey-bit/a9a358907a39ac47f2f38da5223e86a5 to your computer and use it in GitHub Desktop.
Save flakey-bit/a9a358907a39ac47f2f38da5223e86a5 to your computer and use it in GitHub Desktop.
PowerShell script to load AuthorityCode data into GNAF
Param(
[string]$serverName,
[string]$databaseName,
[string]$authorityCodeFilesPath
)
Get-ChildItem $authorityCodeFilesPath -Filter *.psv |
Foreach-Object {
$tableName = $_.name.Replace("Authority_Code_", "").Replace("_psv.psv", "")
write-host "Procesing" $_.Name "into table" $tableName
bcp $tableName in $_.FullName -d $databaseName -S $serverName -t"|" -c -T -F 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment