0

I have been trying various methods to import a shapefile into MSSQL but keep getting

FAILURE: no source datasource provided.

ATTEMPTS

  1. ogr2ogr -f "MSSQL:Server=xxx;Database=_GIS_Test;UID=yyy;PWD=zzz" -nln “D:\QGIS_Development\mssql\bridges.shp” “MGM_Bridges_test” a_srs EPSG:4326 -t_srs EPSG:28354 -nln “MGM_Bridges_test”

  2. CD to folder and

    ogr2ogr -overwrite -f “MSSQLSpatial” “MSSQL:Server=z;Database=_GIS_Test;UID=xxx;PWD=yyy"  bridges.shp a_srs EPSG:4326 -t_srs EPSG:28354 -nln “MGM_Bridges_test”
    

3.

ogr2ogr -overwrite -f “MSSQLSpatial” “MSSQL:Server=z;Database=_GIS_Test;UID=xxx;PWD=yyy" a_srs EPSG:4326 -t_srs EPSG:28354 -nln bridges.shp “MGM_Bridges_test”

ogrinfo on the input dataset opens it.

I have checked many posts here but no one reports this issue. Tried bridges.shp in quotes. I have removed the "“MGM_Bridges_test”" and I get the error No Target Datasource provided.

---- UPDATE

I tried typing the following but still get the same error... enter image description here

ANOTHER attempt -same issue enter image description here

10
  • thanks -there seems to be 2 here. I tried typing it in and I get no datasource provided. This is for the command I added to the question.
    – GeorgeC
    Commented Feb 19, 2019 at 13:53
  • 1
    Please read cafefully the manual pages of ogr2ogr and MSSQL and check your command. At least you have not defined the outputformat, -f should be followed by the driver name -f MSSQLSpatial gdal.org/drv_mssqlspatial.html. Do you really want to create a layer named "bridges.shp" as you now do with your -nln? -a_srs and -t_srs are not supposed to be used together.
    – user30184
    Commented Feb 19, 2019 at 14:19
  • 1
    This last command looks good, but I have no own experience on MSSQL. What is the error now? Adding --debug on to your command may give more information.
    – user30184
    Commented Feb 19, 2019 at 21:36
  • 1
    you have some options after src_dataset_name that are shown in the usage to be expected before. Try ordering these arguments in the way shown in the usage.
    – Mike T
    Commented Feb 19, 2019 at 22:41
  • 1
    the screenshots above show the order of expected commands in their usage.. follow this order. Also try to use regular quotes "x" rather than fancy quotes “x”.
    – Mike T
    Commented Feb 20, 2019 at 0:35

1 Answer 1

1

Thanks to Mike T - it works when formatted exactly as per the help file and not based on the options order that's worked for other people.

ogr2ogr -overwrite -f "MSSQLSpatial" "MSSQL:Server=zzz;Database=NGSC_GIS_Test;UID=xx;PWD=yyy" bridges.shp -a_srs "EPSG:28354" -nln "MGM_Bridges_test"

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.