I have a Shapefile with a number of attribute fields defined in its corresponding .dbf file. I am trying to transfer this data to an Azure SQL Server DB using the following command:

ogr2ogr -f MSSQLSpatial "MSSQL:server=<server>;database=<db>;uid=<username>;pwd=<password>;Driver={ODBC Driver 17 for SQL Server}" <shp file>

This command adds all the features to the database. However, after closer inspection I have noticed that all non-numerical fields have been truncated to a single character.

Now, the strange thing is that the types of the SQL columns were instantiated such that they should be able to fit the data. Could this be an encoding problem, as some of the fields contain French characters?

I am using GDAL 2.2.3, released 2017/11/20


1 Answer 1


The problem was an outdated version of GDAL. I was running into this issue, which has been fixed in GDAL 2.4.0. On Ubuntu, you can easily install it by following these steps:

sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get update
sudo apt-get install gdal-bin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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