3

I have a SQL Server table with two geometry spatial columns (A, B). I have created two rows in geometry_columns table for both of these.

f_table_catalog f_table_schema  f_table_name    f_geometry_column   coord_dimension srid    geometry_type
neil            dbo             Temp_CSVLoad    [A]                 2               27700   POINT
neil            dbo             Temp_CSVLoad    [B]                 2               27700   POINT

If I go into QGIS and add a SQL Server layer, it finds and shows me these two layers as choices correctly, but no matter which one I select it only ever plots A, whether I select to add the row linked to column A or column B. If I look at the properties, it is definitely showing the correct column as part of the properties.

If I null column A and only add a layer for B, I get nothing. If I null column B and only add a layer for B, I still get A.

Am I doing something obviously wrong?

1

QGIS might be looking the column up based on table name.

Maybe you could create a view for each one. I know this is adding complexity to your DB, but it would confirm it and would be an adequate workaround.

Another way to test is the change the order that the two tables are listed, i.e., switch [A] and [B] in the rows and see if that changes it.

It is likely a bug in QGIS, if this is the case.

1

The QGIS browser panel doesn't seem to recognize and display the two geometry columns, but manually adding them from the 'Add MSSQL Spatial Table' does:

enter image description here

The above showing a table from which I have converted the polygons into centroid points into a 2nd geometry column.

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.