Obviously, this is good only when loading name-value pairs from a table to a hashtable. This uses the sqlpsx Get-SqlData cmdlet:
$hash = New-Object ('System.Collections.Hashtable') $ArrayOfDataRows = Get-SqlData -sqlserver $ServerName -dbname $DatabaseName -qry "EXEC dbo.usp_GetNameValuePair" | %{$hash.Add($_.Name, $_.Value);}
how to get values from hash table to sql table using powershell?