Fixing tests in SQL Server