I have some tab files that are actually references to a view in a MS SQL Server table. It looks like
begin_metadata
"\IsReadOnly" = "FALSE"
"\MapInfo" = ""
"\MapInfo\TableID" = "055372be-523f-430a-b603-bbd462ad3efd"
"\DATALINK" = ""
"\DATALINK\ConnectionString" = "DSN=xxx_GIS;UID=sa;APP=MapInfo Professional®;WSID=AS00769;DATABASE=xxx_GIS"
"\DATALINK\Query" = "select ""assetID"", ""assetName"", ""ward"", ""locality"", ""GID"", ""location"", ""assetClass"", ""assetSubClass"", ""assetType"", ""hierarchy"", ""dimensionsLength"", ""MI_PRINX"", ""MI_STYLE"", ""OBJECT"" from ""NGSC_GIS"".""dbo"".""v"
"\DATALINK\Query\+1" = "w_ASSET_Bridge"""
end_metadata
In QGIS the view is like
<layer-tree-layer expanded="1" source="dbname='xxx_GIS' service='xxx_GIS' estimatedmetadata=true disableInvalidGeometryHandling='0' table="dbo"."vw_ASSET_Bridge" (SP_GEOMETRY) sql=" id="vw_ASSET_Bridge_1a8f7b4e_d11d_4a9e_b5ba_773aafe7014b" checked="Qt::Checked" providerKey="mssql" name="vw_ASSET_Bridge">
<customproperties/>
</layer-tree-layer>
<layer-tree-layer expanded="1" source="../../GIS/Data/ASSET_Bridge.TAB" id="ASSET_Bridge_b0c1d436_6728_428f_a1dc_f22c15fe8c38" checked="Qt::Checked" providerKey="ogr" name="ASSET_Bridge">
<customproperties/>
</layer-tree-layer>
Using the advice in https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/
I see the command should be something like
ogr2ogr -f “ESRI Shapefile” “C:\scratch\vw_ASSET_Bridge.shp” “MSSQL:server=xxx_GIS;database=xxx_GIS;trusted_connection=yes;” -sql “SELECT [ID],[GeoType],[GeoName],GEOMETRY::STGeomFromWKB([GeoShapes].STAsBinary(),28354) As [GeoShape] FROM dbo.vw_ASSET_Bridge WHERE [GeoShapes].STGeometryType() = ‘POINT'” -overwrite -a_srs “EPSG:28354”
But I am not sure what should be used for the tags in []