1

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日

asked Jul 11, 2019 at 14:13
1

1 Answer 1

2

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
answered Jul 11, 2019 at 15:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.