Feature request #12324
QGIS 2.8 Wien - Crashed on SQL Server Spatial Layers
|Pull Request or Patch supplied:||No||Resolution:||duplicate|
2.8 crashed on SQL Server Spatial tables and views. This has been a bug since version 2.0.1. 2.0.1 didn't support GUID fields but didn't crash - see #9007. 2.8 simply crashes even if they are no GUID fields. It simply does not work! I think we have regressed a bit when it comes to vector layers from SQL Server Spatial.
#8 Updated by Nathan Woodrow over 2 years ago
Ok yes it is that. If you have the
uniqueidentifier as the primary key all the feature ids come out as 0, but if set to
OBJECTID you will get correct ids.
Currently QGIS doesn't handle having GUID columns as a key column, it will need to be a int or bigint.
#9 Updated by Ali Diba over 2 years ago
- File SQLTablePlusdata.sql added
Please use this attached SQL table and data. It has no GUIDs. Data types are datetime, nvarchar, varchar, int, and geometry. 2.8 Returns the following error:
dbname='FM_SpatialViews' host=sw-demo3 user='xxx' password='xxxx' srid=3857 type=POINT table="dbo"."test1" (Shape) sql= is an invalid layer - not loaded
#11 Updated by Ali Diba over 2 years ago
I realized that after I posted my last update. I added an int column and things started working. I now know the pattern that I need to use to bring SQL Server Spatial layers into QGIS. I need an int/bigint based primary key and avoid GUID as key. It would be nice to support GUIDs as key columns in the future. This is important if we start using QGIS to collect features in the field in disconnected mode and merge them with existing features in the office. GUID can be used as the unique internal id in this case.
Thank you for your response and attention to my issue.
#17 Updated by Robert Slivinsky about 2 years ago
I have had similar issues editing MSSQL tables in QGIS. Seems to work fine for so many saves. Then after a while, when clicking save table, it takes longer to save. Then trying to save edits again, it freezes. While I assumed this was only a MSSQL editing issue, I believe I noticed a similar thing happen when editing .shp files so I wonder if it is purely related to MSSQL saves. Thanks, Rob