MDL-38147 do not use DB->sql_length because it does not work on MSSQL