diff --git a/src/Driver/SQLServer/SQLServerCompiler.php b/src/Driver/SQLServer/SQLServerCompiler.php index 81db1bec..17a981fa 100644 --- a/src/Driver/SQLServer/SQLServerCompiler.php +++ b/src/Driver/SQLServer/SQLServerCompiler.php @@ -152,7 +152,7 @@ private function baseSelect( $this->optional(' ', $this->compileDistinct($bindings, $distinct)), $this->compileColumns($bindings, $columns), $tableNames, - $this->optional(' ', $forUpdate ? 'WITH (UPDLOCK, ROWLOCK)' : '', ' '), + $this->optional(' ', $forUpdate ? 'WITH (UPDLOCK,ROWLOCK)' : '', ' '), $this->optional(' ', $joinsStatement, ' '), $this->optional("\nWHERE", $this->compileWhere($bindings, $whereTokens)), $this->optional("\nGROUP BY", $this->compileGroupBy($bindings, $grouping), ' '), diff --git a/tests/Database/SQLServer/SelectQueryTest.php b/tests/Database/SQLServer/SelectQueryTest.php index b9cb0a79..31c05bf6 100644 --- a/tests/Database/SQLServer/SelectQueryTest.php +++ b/tests/Database/SQLServer/SelectQueryTest.php @@ -78,7 +78,7 @@ public function testSelectForUpdate(): void ->forUpdate(); $this->assertSameQuery( - 'SELECT * FROM {users} WITH(UPDLOCK) WHERE {name} = ?', + 'SELECT * FROM {users} WITH(UPDLOCK,ROWLOCK) WHERE {name} = ?', $select ); }