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日
-
I think I am running into this issue: github.com/OSGeo/gdal/issues/843jelleve– jelleve2019年07月11日 15:08:33 +00:00Commented Jul 11, 2019 at 15:08
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