<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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Time new Roman \,serif\;color\:red";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Time new Roman \,serif";
        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";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        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.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;}
span.E-MailFormatvorlage22
        {mso-style-type:personal;
        font-family:"Tahoma",sans-serif;
        color:windowtext;}
span.E-MailFormatvorlage23
        {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 Bo,<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">thank you for the links. I’ve tried some examples from
</span><a href="https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/"><span lang="EN-US">https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/</span></a>
<span lang="EN-US">and others but all tests starting with MSSQL throw an error, even if I just query a simple table with only one geometry attribute. The pattern that I’ve used is from this page:
<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">
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>. It is from 2012 but should still work.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="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">One of my problems with software is that I’m not allowed to install anything. We have a central department that cares for thousands of computers with
 the focus on standardization and security issues. If I want to have installed something, I have to order it, than a package will be produced and tested and after weeks or months it will be provided in the software center of my computer. So I was happy to have
 QGIS installed that brings some GDAL features with it.<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">Maybe the GDAL-DEV group will tell me that I’ll have to make a complete install. Than it will take some time.<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">Michael<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"><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> Qgis-user <qgis-user-bounces@lists.osgeo.org> <b>
Im Auftrag von </b>Bo Victor Thomsen via Qgis-user<br>
<b>Gesendet:</b> Donnerstag, 20. Oktober 2022 14:36<br>
<b>An:</b> qgis-user@lists.osgeo.org<br>
<b>Betreff:</b> Re: [Qgis-user] 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>
<p>Hi Michael -<o:p></o:p></p>
<p>1) You can get a complete windows GDAL/OGR setup from <a href="https://www.gisinternals.com/">
https://www.gisinternals.com/</a><o:p></o:p></p>
<p>2) Have you read this article : <a href="https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/">
https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/</a> <o:p></o:p></p>
<p>Especially the chapter about exporting data from SQL-Server. <o:p></o:p></p>
<p>An example:<o:p></o:p></p>
<div>
<div>
<pre><code>ogr2ogr</code><o:p></o:p></pre>
</div>
<div>
<pre><code>-f "KML"</code><o:p></o:p></pre>
</div>
<div>
<pre><code>"C:\temp\precincts.kml"</code><o:p></o:p></pre>
</div>
<div>
<pre><code>"MSSQL:server=localhost\denali;database=tempdb;trusted_connection=yes;"</code><o:p></o:p></pre>
</div>
<div>
<pre><code>-sql "SELECT prcnts_id, geog4326.STAsBinary() FROM precincts_reprojected"</code><o:p></o:p></pre>
</div>
<div>
<pre><code>-overwrite</code><o:p></o:p></pre>
</div>
</div>
<p>I have a hunch, that your problem stems from the use of both a geometry and a geography column in the same table. The -sql "select a,b..." might eliminate this problem by only including one of the geometry columns in the field lidst.<o:p></o:p></p>
<p><o:p> </o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>Med venlig hilsen / Best regards<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Bo Victor Thomsen<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<div>
<p class="MsoNormal">Den 20-10-2022 kl. 13:59 skrev Reetz, Michael (NLPV) via Qgis-user:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Hi Andrea and Ian,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">yes, I’ve read the documentation and a lot of other tips. I’ve signed in to the gdal-dev mailing list and will post my problem there as soon as the registration
 is done. I will post the result here if there is a solution.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Thanks and best regards</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Michael</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>Von:</b> Qgis-user <a href="mailto:qgis-user-bounces@lists.osgeo.org">
<qgis-user-bounces@lists.osgeo.org></a> <b>Im Auftrag von </b>Andrea Giudiceandrea via Qgis-user<br>
<b>Gesendet:</b> Donnerstag, 20. <span lang="EN-US">Oktober 2022 11:14<br>
<b>An:</b> <a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a><br>
<b>Betreff:</b> Re: [Qgis-user] ogr2ogr doesn't connect to MS SQL Server</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"> </span><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",serif">ACHTUNG!!</span><span style="font-size:10.0pt;font-family:"Time new Roman ,serif",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.</span><o:p></o:p></p>
</div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:13.5pt">Reetz, Michael (NLPV)</span></b><span lang="EN-US" style="font-size:13.5pt"><br>
</span><i><span lang="EN-US" style="color:black">Thu Oct 20 01:39:42 PDT 2022</span></i><span lang="EN-US">
</span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" noshade="" style="color:black" align="center">
</div>
<pre style="white-space:pre-wrap;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px"><span lang="EN-US" style="color:black">So, it looks as if ogr2ogr is not really helpful for me and I have to look for another tool.</span><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span lang="EN-US"><br>
Hi Michael,<br>
AFIAK QGIS has its own MSSQL provider since 2012, while ogr2ogr relies on the GDAL/OGR library to connect to an MSSQL server: have you already read the documentation at [1]?<br>
<br>
I suggest you to also ask the gdal-dev mailing list [2] for help.<br>
<br>
Best regards.<br>
<br>
Andrea Giudiceandrea<br>
<br>
[1] </span><a href="https://gdal.org/drivers/vector/mssqlspatial.html"><span lang="EN-US">https://gdal.org/drivers/vector/mssqlspatial.html</span></a><span lang="EN-US"><br>
[2] </span><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"><span lang="EN-US">https://lists.osgeo.org/mailman/listinfo/gdal-dev</span></a><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Qgis-user mailing list<o:p></o:p></pre>
<pre><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><o:p></o:p></pre>
<pre>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
<pre>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre>
</blockquote>
</div>
</div>
</body>
</html>