Reputation: 3065
I have a stored procedure in SQL Server 2012 and when it is ran it returns one row with 3 columns.
In powershell I can return the data into a data table.
$sqlConnection.Open()
$sqlCommand = New-Object System.Data.SqlClient.SqlCommand
$sqlCommand.Connection = $sqlConnection
$sqlcommand.commandtext = "GetPlantLoadFactor"
$sqlCommand.CommandType = [System.Data.CommandType]::StoredProcedure
$result = $sqlCommand.executereader()
$table = new-object “System.Data.DataTable”
$table.Load($result)
$PLF = $table
$sqlConnection.close()
$PLF
All I want is the Value field of 65.89. Is there a better way to do this and how do I just return the value of 65.89 into the variable $PLF
?
Upvotes: 1
Views: 2312