ctigeek / InvokeQueryPowershellModule

A Powershell module of Cmdlets for querying most types of databases.
https://www.powershellgallery.com/packages/InvokeQuery
MIT License
58 stars 10 forks source link

ExpectedRowCount doesn't work for multiple piped sql queries. #3

Closed ctigeek closed 7 years ago

ctigeek commented 7 years ago

If you pipe in multiple sql queries, and include the ExpectedRowCount property, you would expect the value included with the property to match the number of rows modified by all sql statements. That is not the case and results in a transaction rollback.

$sql1 = "update table1 set column1 ='value1' where pk = 1;"
$sql2 = "update table1 set column1 = 'value2' where pk = 2;"
##this will result in a rollback
($sql1,$sql2) | Invoke-SqlServerQuery -ExpectedRowCount 2 -CUD
ctigeek commented 7 years ago

Fixed.