Tuesday 17 March 2015

Powershell - Exporting data using bcp

$database = "Chinook"
$schema = "dbo"
$table = "Album"
$filename = "C:\Temp\results.txt"

$bcp = "bcp $($database).$($schema).$($table) out $filename -T -c"
Invoke-Expression $bcp

1 comment:

  1. thanks, the Invoke-Expression worked better than my previous method.

    ReplyDelete