ODBC string connect to specific table

133 Views Asked by At

I'm connecting to a SQL Server spatial database by using ogr2ogr with the MSSQL driver.

C:\>ogr2ogr -f "GeoJSON" C:\Users\usr_m\Documents\shape_odbc.geojson "MSSQL:Driver=SQL Server;server=hksql;database=ql51pd;trusted_Connection=yes;"

as specified here and here

But I'd like to connect to download a certain table, any suggestions how I do that?

Maybe I need to fetch it in python or make another workaround.

1

There are 1 best solutions below

0
On BEST ANSWER

As suggested on a side-note here. The string has to look like this:

C:\>ogr2ogr -f "GeoJSON" C:\Users\usr_m\Documents\shape_odbc.geojson "MSSQL:Driver=SQL Server;server=hksql;database=ql51pd;trusted_Connection=yes;" **<table>**