1

I have a GIS feature class of lines in a file geodatabase that I want to export directly to SQL Server. I only have ArcMap 10.0 to view this file and I can't see how it is possible using that. Usually, I export to shapefile and then upload from there but this is over 2Gb so I want to do it directly.

I already have the database set up in SQL Server, I just want to export directly from ArcMap and create a new table in SQL.

Is this possible?

I have tried using the Feature Class to Feature Class tool, and create a new Database Connection. If I test the connection, it works fine, however when i save the new Database Connection it has a little red cross next to it and still doesn't work. Any ideas?

11
  • Can you please explain what exactly are you trying to achieve? I have a hard time understanding what is your problem. Mar 15, 2018 at 16:00
  • @AlexTereshenkov - I just want to export a table of lines from a file geodatabase to SQL Server?
    – al_sweets
    Mar 15, 2018 at 16:04
  • 2
    ArcGIS 10.0 isn't going to connect to any database released this decade. Please Edit the question to specify the exact versions of all software (including service packs)
    – Vince
    Mar 15, 2018 at 22:35
  • 1
    Note that the answer to 99% of "Is this possible?" questions is "Of course, with a bit of work" (the remainder are "a lot of work" and "an awful lot of work").
    – Vince
    Mar 16, 2018 at 2:15

1 Answer 1

0

As said, there is no one-click tool to achieve this within ArcGIS or ArcPro standard packages.

GDAL and its OGR2OGR tool can be used to transfer shapefiles to MS SQL Server relatively painlessly and without writing code.

So export to a shapefile, then execute the following from a shell script:

ogr2ogr -f "MSSQLSpatial" "MSSQL:server=localhost;database=<database name>;trusted_connection=yes;" "my_exported_shape_file.shp" -progress

The ogr2ogr documention documents many additional arguments.

In the spirit of the question, a quick but dirty way of building this into a tool in ArcGIS would be to have a python script export to a shapefile, then generate and execute an OGR2OGR shell call.

After that there would be many options of mediating data transfer through many python packages, like pysql, SQLAlchemy and geopandas, or working natively with WKT formats to transfer spatial data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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