<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Time new Roman";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-reply;
        font-family:"Tahoma",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Hi Pedro,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">I’ve found msodbcsql17.dll in C:\Program Files\QGIS 3.22.8\bin\1033 and C:\Program Files\QGIS 3.22.8\bin.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Gdal-mss seems not to be on my computer. But since SQL Server Native Client isn’t supported by MS SQL Server 2019 , this shouldn’t be a Problem.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">I have only the OSGeo4W Shell shipped installed with QGIS. So, the nice setup frontend is missing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Best regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Michael<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>Von:</b> Pedro Venâncio <pedrongvenancio@gmail.com> <br>
<b>Gesendet:</b> Donnerstag, 20. Oktober 2022 16:31<br>
<b>An:</b> Reetz, Michael (NLPV) <Michael.Reetz@nlpvw.niedersachsen.de><br>
<b>Cc:</b> gdal-dev@lists.osgeo.org<br>
<b>Betreff:</b> Re: [gdal-dev] ogr2ogr doesn't connect to MS SQL Server<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:solid #003333 1.0pt;padding:2.0pt 2.0pt 2.0pt 2.0pt">
<p style="line-height:10.0pt;background:#D5EAFF"><span style="font-size:10.0pt;font-family:"Time new Roman",serif;color:red">ACHTUNG!!</span><span style="font-size:10.0pt;font-family:"Time new Roman",serif"> Diese E-Mail erreicht Sie von einem Absender außerhalb
 der niedersächsischen Landesverwaltungs-Infrastruktur mit TLS-Verschlüsselung. Bitte klicken Sie auf keine Links oder öffnen Sie keine E-Mail-Anhänge, falls Sie den Absender nicht kennen und nicht wissen, ob der Inhalt sicher ist.<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal">Michael, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Check if you have <code><span style="font-size:10.0pt">gdal-mss</span></code> and
<code><span style="font-size:10.0pt">msodbcsql</span></code> libs installed, like here: <a href="https://github.com/PedroVenancio/export_to_sql_server/issues/2#issuecomment-1240675079">https://github.com/PedroVenancio/export_to_sql_server/issues/2#issuecomment-1240675079</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Pedro<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Reetz, Michael (NLPV) <<a href="mailto:Michael.Reetz@nlpvw.niedersachsen.de">Michael.Reetz@nlpvw.niedersachsen.de</a>> escreveu no dia quinta, 20/10/2022 à(s) 15:13:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">Dear members of the GDAL-DEV group,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">we are using MS SQL Server 2019 as basis for Geoserver and GIS software. There are a lot of tables that have attributes
 of the types geometry and/or geography. I can load these tables into QGIS (3.22.8) projects without any problems.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">Now I’m asked to add an geography attribute to one table that has already an geometry attribute and populate it with coordinates
 by transforming the geometry values. I’ve found code how to do this with ogr2ogr here:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"><a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/335d3f6b-11f4-4e02-8d6d-b49cb59ed98d/using-ogr2ogr-to-reproject-within-a-sql-table?forum=sqlspatial" target="_blank">https://social.msdn.microsoft.com/Forums/sqlserver/en-US/335d3f6b-11f4-4e02-8d6d-b49cb59ed98d/using-ogr2ogr-to-reproject-within-a-sql-table?forum=sqlspatial</a></span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">Since ogr2ogr is part of the OSGeo4W Shell installed with QGIS, I’ve tried to run this command there.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">ogr2ogr -f "MSSQLSpatial" "MSSQL:server=<my server IP>;driver=ODBC Driver 17 for SQL Server;database=<my database>;trusted_connection=yes;"
 "MSSQL:server=<my server IP>;driver=ODBC Driver 17 for SQL Server;database=<my database>;trusted_connection=yes;" -sql "SELECT <my attributes>, GEOM.STAsBinary(), WGS84 FROM <my table>" -s_srs "EPSG:25832" -t_srs "EPSG:4326" -update -lco "GEOM_TYPE=geography"
 -lco "GEOM_NAME=WGS84" -nln "<my table>"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">But I receive the error message:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">“Unable to open datasource `MSSQL:server=<my server IP>;driver=ODBC Driver 17 for SQL Server;database=<my database>;trusted_connection=yes;'
 with the following drivers. …” </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">MSSQLSpatial is not listed.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">I’ve tried some other commands but all with MSSQL in it leads to an error.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">Any idea what I can do to make it run?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif">Thanks in advance and best regards,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif">Michael</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif">Mit freundlichen Grüßen</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif">Im Auftrag</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif">Michael Reetz</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Tahoma",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif">*****************************************
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif">Michael Reetz</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif">Datenbanken und Anwendungsentwicklung<br>
Nationalpark-Verwaltung Niedersächsisches Wattenmeer <br>
Virchowstr. 1 | 26382 Wilhelmshaven <br>
Tel.: +49 (0) 4421 911 291 <br>
e-mail: <a href="mailto:michael.reetz@nlpv-wattenmeer.niedersachsen.de" target="_blank">
michael.reetz@nlpvw.niedersachsen.de</a> <br>
Web: <a href="https://www./" target="_blank">https://www.</a><u><span style="color:blue"><a href="http://nationalpark-wattenmeer.de" target="_blank">nationalpark-wattenmeer.de</a></span></u>
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><img border="0" width="219" height="118" style="width:2.2812in;height:1.2291in" id="m_5251289661280216092Grafik_x0020_1" src="cid:image001.png@01D8E4A4.399CB390"><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></p>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>