Get max ID value in PowerShell 5.1 DataTable

Viewed 39

I'm using Invoke-SqlCmd to get a DataTable result. Is there a way to get the max value of the ID column in the DataTable in PowerShell?

$sqlResult = Invoke-Sqlcmd -Query 'select * from customer' -ServerInstance '(localdb)\MSSQLLocalDB' -Database 'Database1' -OutputAs DataTables
$sqlResult.GetType()
$sqlResult | Out-Host

enter image description here

0 Answers
Related