Это производственный код, поэтому у меня нет возможности проверить наличие ошибок.
Трассировка SqlProfile показывает, что обновление проверено 7 раз.
$query = "Select pkey, field1 from Table1 with (NOLOCK) where etc ....;";
$unitsrs = sqlsrv_query($conn,$query) or die('sqlsrv error: ' . print_r( sqlsrv_errors()) );
while($unitsrow = sqlsrv_fetch_array($unitsrs)) {
$pkey = $unitsrow['pkey'];
$field1 = $unitsrow['field1'];
$newvalue = 0;
...
$update = "Update Table1 Set Field1 = $newvalue where pkey = '$pkey';";
sqlsrv_query($conn, $update);
}
Удалить точку с запятой из запроса обновления
$update = "Update Table1 Set Field1 = $newvalue where pkey = '$pkey'";