Fixed MS SQL issue, closes #712