执行PowerShell后无法查看所有列

时间:2017-11-02 05:37:38

标签: powershell

执行PowerShell脚本后,我无法看到sql server的所有列。

有人可以解释一下吗?

我开发的脚本是:

$dataSource = "xxxxxxxxxxxxx"
$user = "zzzzzzzz"
$pwd = "cccccccc"
$database = "aaaaaaaaaaaa"
$connectionString = "Server=$dataSource;uid=$user; pwd=$pwd;Database=$database;Integrated Security=True;"
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()
$query = "SELECT * FROM [dbo].[table]"
$command = $connection.CreateCommand()
$command.CommandText = $query 
$result = $command.ExecuteReader()
$table = new-object "System.Data.DataTable"
$table.Load($result)
$table | format-table  $format -Wrap -AutoSize | Out-String -Width 4096 | Out-File C:\test\pratik.txt
$connection.Close()

0 个答案:

没有答案