Sunday, May 15, 2016

OGR MSSQL bulk insert support added in GDAL 2.1

With the release of GDAL 2.1.0 the new bulk insert support has been added to the OGR MSSQL Spatial driver. Using the bulk insert option the upload is approx. 20 times faster comparing to the earlier driver versions, which is especially useful when uploading large data tables to MSSQL server.

The bulk insert option involved the need to implement the write support for the native SqlGeometry/SqlGeography serialization formats, which in turn eliminates the need of the server side geometry conversions from WKB and WKT causing large amount of memory pressure at the server and may cause issues like this one.

The implemented bulk insert support requires the SQL Server Native Client 10+ driver to be installed on the system. This is installed along with a SQL server setup or available from a separate package provided by Microsoft. This requirement is a bit unpleasant for the binary distribution providers, because the driver should link against the corresponding sqlncli dll. Therefore we added support to build the MSSQL spatial driver as a plugin dll (ogr_MSSQLSpatial.dll). The gdal-core msi installers (development, daily) at GISInternals have been modified to include the bulk insert enabled MSSQL driver as an optional component (not installed by default). If you enable this component, make sure that the SQL Server Native Client 11 driver is also installed on your the system, otherwise ogr2ogr will likely fail to start.

By installing this driver, the bulk insert option is enabled by default when using MSSQLSpatial as an ogr2ogr target database, however we can disable bulk insert by using the MSSQLSPATIAL_USE_BCP=FALSE config option which turns the upload to a set of "INSERT INTO" operations as usual, but that option continues to use the native geometry/geography serialization formats. We could also select the earlier WKT/WKB upload by using the UPLOAD_GEOM_FORMAT layer creation option. For more information about the config and layer creation options supported by the driver please refer to the MSSQL Spatial driver information page.


  1. Firstly thanks for all the great work, especially on the MS SQL.

    I've just updated to 2.0 and I'm getting a bcp error about invalid table name when I try an import that previously worked. The MapInfo layer name was "Borough Wards". If I use the -nln "Wards" option, data loads fine

    1. I've just fixed this one in GDAL trunk and branch 2.1 within the scope of this bug:

  2. Thanks for the (extremely) quick response

    No sure where to get this ... is this in the Stable branches daily list at

  3. Heads-up: as per Microsoft at support for the SQL Server Native Client is not avauilable for SQL Server 2016.

    1. As far as the recent "official" ODBC drivers will support the bcp operations (without significant issues) we are good to go.

    2. As far as the recent "official" ODBC drivers will support the bcp operations (without significant issues) we are good to go.

  4. With the invention of smartphones, watching movies and tv shows have become so easy.
    We no longer have to wait for the shows to be telecasted on tv.
    Instead we can just download some great apps like Playbox, which provides free streaming of videos and tv shows.
    It is becoming very popular day by day and you must check it out.
    PlayBox HD Apk Download

  5. We all live to play games on our smartphones.
    But what bugs the most is the ads those games contain and the in-app purchase option we have to go through to get the full version of those games.
    Freedom is such a unique application which frees you from these troubles. Want to know more about the Freedom app? Check out this website Download Freedom Apk Now

  6. you can also download Freedom apk latest version
    from our site for more fun

  7. The 2020 Masters Tournament will be watch Masters live Tournament and the first of golf's four major championships to be held in 2020.

  8. It is even a good way for the fan to enjoy the Super Bowl 2020 Live Stream game even if you do not wish to opt for any contract cable. Not only Super Bowl live, but you can also enjoy the different sporting events on the television. You simply need a good connection along with the Sling Blue Package.

  9. The 2020 Summer Olympics, officially known as the Games of Field hockey 2020 Summer Olympics and commonly known as Tokyo 2020 or the Recovery Olympics.

  10. Thanks for sharing Such a valuable post and for more information. please follow the link- Virtual reality development companies

  11. 1 World Figure Skating Championships 2020
    4 World Figure Skating Championships 2020 Live Stream Online
    5 World Figure Skating Championships 2020 Live on Smartphone
    6 World Figure Skating Championships 2020 Live on Cable
    7 World Figure Skating Championships 2020 Live without Cable
    8 World Figure Skating Championships 2020 Live on Playstation
    Click To Watch Now
    World Junior Figure Skating Championships 2020 Live Stream

  12. Wilder vs Fury 2 Live Stream Rematch PPV Online
    Wilder vs Fury 2 Live After February 22nd there will be no more unanswered questions. I will finish what I started, and this time @Tyson_Fury will not be getting up off that canvas so quickly. I’ve proven myself time and time again and I will do it again in February.Wilder and Fury first met in December 2018, and the fight ended in a split draw. Since then, both Wilder and Fury have won two consecutive fights. Then Wilder vs Fury will face Fury in a rematch on February 22, 2020 at the MGM Grand in Las Vegas. Joshua fought in Saudi Arabia last month,