Bug report #10970

MS SQL server: error with tinyint fields

Added by Paolo Cavallini over 9 years ago. Updated over 7 years ago.

Assignee:Nathan Woodrow
Category:Data Provider/MSSQL
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:No Copied to github as #:19316


I loaded a MS SQL (non spatial) table. When attempting to save it as dbf, I always get an error (something like "Variant type not valid for field XXX : uint received with type 0).

Fields throwing errors are of type ``tinyint``.

Related issues

Related to QGIS Application - Bug report #12841: Save as shapefile fails on PostGIS layer with joined MSSQ... Closed 2015-05-28


#1 Updated by João Gaspar over 9 years ago

Hi Paolo, i don't know the level of your urgency but you can use the MMQIS plugin as workaround to export data from non spatial tables of MSSQL in csv format.

I test with a small table non spatial and work.
My OS info: Windows 7 64-bit
QGIS Version: QGIS Chugiak 64-bit (OSGeo4W installer)

UPDATE: I can create .dbf and .csv in export option, but in some tables. Another thing, i'm having problem open some Views, and some tables give me the same error as you report. For the problem itself, i think is the type of the field (is only a hint).

Best Regards

#2 Updated by Paolo Cavallini over 9 years ago

Thanks, it works. A proper solution should be implemented in core anyway.

#3 Updated by Nathan Woodrow over 9 years ago

  • Assignee set to Nathan Woodrow

#4 Updated by Filip Mahieu over 8 years ago

I do have the same problem (in Qgis 2.8 32-bit, OS XP, SQL-Server 2008R2, spatial table), indeed with datatype 'tinyint'. Changing the datatype to 'smallint' solved the problem.
Problem did only exist if there was effectively data entered in the field (Null-values do not throw error). Exports to shape also throws the error.

#5 Updated by Nyall Dawson almost 8 years ago

  • Status changed from Open to Feedback

I can't reproduce this - can you please test with latest master and confirm whether it's still an issue?

#6 Updated by Giovanni Manghi over 7 years ago

  • Status changed from Feedback to Closed
  • Resolution set to not reproducable

closing for lack of feedback. Please reopen if necessary.

#7 Updated by Filip Mahieu over 7 years ago

When tested with 2.14.0 the problem does not seem to exist anymore.

Also available in: Atom PDF