qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
9.82k stars 2.9k forks source link

Copying Attributes From Attribute Table Not Working For MS SQL Server Tables #57237

Open zachwright95 opened 2 months ago

zachwright95 commented 2 months ago

What is the bug or the crash?

I am trying to copy records from a mapping layer directly into Excel, which works for various file formats, such as .TAB, .MID/MIF and .SHP, however with MS SQL Spatial tables, it pastes the records in Excel with only NULL under the field "wkt_geom", then the rest of the table's columns are shown at the top with blank values under them, even though these are all populated in QGIS.

I've tried this on two different devices, probably half a dozen layers and three different versions of QGIS (including the latest 3.36.1-Maidenhead - 3e589453).

Steps to reproduce the issue

  1. Under MS SQL Server in the Browser, create a SQL Spatial connection to a server. Find the database, and have the checkboxes "Also list tables with no geometry" "Use estimated table parameters" and all schemas ticked. Click on "OK" to add the table.

  2. Go to the added database in the browser and select a table within it and add it to the QGIS project.

  3. Right click on the newly added layer, select "Open Attribute Table"

  4. Open Excel.

  5. Select all or some records in the QGIS attribute table, copy the records.

  6. Go to Excel and attempt to paste in cell A1 of a blank sheet.

Versions

QGIS version 3.36.1-Maidenhead QGIS code revision 3e589453 Qt version 5.15.3 Python version 3.9.18 GDAL/OGR version 3.8.4 PROJ version 9.3.1 EPSG Registry database version v10.098 (2023-11-24) GEOS version 3.12.1-CAPI-1.18.1 SQLite version 3.41.1 PDAL version 2.6.0 PostgreSQL client version 16.2 SpatiaLite version 5.1.0 QWT version 6.1.6 QScintilla2 version 2.13.4 OS version Windows Server 2016 Version 1809

Active Python plugins qfieldsync v4.2.0 grassprovider 2.12.99 MetaSearch 0.3.6 processing 2.12.99

Supported QGIS version

New profile

Additional context

No response

GrizzlyBolt commented 1 month ago

I have the same problem. If I select a single cell in the attribute table, right click, and "Copy Cell Content" it will correctly paste the data but the full table copy and paste fails every time in the same fashion as outlined in the ticket. Likewise, if I select features on the map, then select "Export" -> "Save Selected Features As..." and go through the steps, the file is empty.