Fixed for MS SQL queries