RAZ-3117: Patch for older versions of MS SQL Server
- Fixed issues with differences in query syntax in older versions of MS SQL server