1

I am connecting to an MSSQL database table which does not have a geometry type field, but has coordinates in separate columns. The ODBC connection works, but when I bring the table in to QGIS, it is filtered, with no way to unfilter it, so I only see one row in the attribute table.

Has anyone seen this and know how to see all features?

I have tried other tables from databases with the same schema and most show up fine, but occasionally others have the same issue.

enter image description here

2

Check the primary keys in 'problematic' SQL Server tables and if they don't exist, try to add it (as a unique integer).

Queries that QGIS created and sent to SQL Server sometimes do not choose a proper unique integer column in tables without a primary key defined. It simply chooses the first INT column available by order in a table definition (and sometimes that column could contain values that are not unique). As a result, it sends back weird results (only one row in your case).

1
  • I've done some more investigating. The primary keys are all okay. There appear to be some records with carriage returns or line feeds in them, and others with coordinates way out of range. For those tables only the last record is being shown in QGIS. Still looking into other causes. – Ian Dec 4 '20 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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