Bug fix: SQL Server clause incorrect