I recently moved from QGIS 2.2 to 2.4.0 and in the process the MSSQL spatial data provider appears to have stopped working properly (behaviour is also the same with 2.5.0).

QGIS will still connect to an MSSQL table and will display the geometry, however it is not possible to filter it with a query, the SRID is not being read from the geometry_columns table and more importantly it is not possible to commit any edits back to the database.

I am running SQL Server 2012 - the geometry_columns table is present and populated correctly and all tables have integer primary key columns, etc.

Has anyone else encountered this problem? I am a bit perplexed as I have never experienced any problems prior to updating to 2.4.0.

  • Could it have something to do with the check boxes near the bottom of the "New MSSQL Connection" window shown here. i.imgur.com/8yc3x9G.png Sep 12, 2014 at 13:02
  • I don't think so, as these controls are not new additions from 2.2. I have tried selecting and unselecting 'Use estimated table parameters' but it has no effect.
    – Will
    Sep 12, 2014 at 13:48

1 Answer 1


The problem might be known and already solved in latest builds:



and the following messages.

  • I've tried the most recent build (2.5.0-71) but still get the same problem. Attempts to filter an MSSQL layer result in the message 'QSqlQuery::exec: database not open' being generated in the Qt message log - I don't know if that adds anything?
    – Will
    Sep 12, 2014 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.