fixes #590

Run the test

``` 
$ rake test_mssql TEST=test/db/mssql/unit_test.rb

```

I could not run this fix against MS SQL database yet as I have some trouble with running this from a Mac.