<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Michael -</p>
    <p>1) You can get a complete windows GDAL/OGR setup from
      <a class="moz-txt-link-freetext" href="https://www.gisinternals.com/">https://www.gisinternals.com/</a><br>
    </p>
    <p>2) Have you read this article :
      <a class="moz-txt-link-freetext" href="https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/">https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server/</a> <br>
    </p>
    <p>Especially the chapter about exporting data from SQL-Server. <br>
    </p>
    <p>An example:</p>
    <pre><div class="container"><div class="line number1 index0 alt2"><code class="sql plain">ogr2ogr</code></div><div class="line number2 index1 alt1"><code class="sql plain">-f </code><code class="sql string">"KML"</code></div><div class="line number3 index2 alt2"><code class="sql string">"C:\temp\precincts.kml"</code></div><div class="line number4 index3 alt1"><code class="sql string">"MSSQL:server=localhost\denali;database=tempdb;trusted_connection=yes;"</code></div><div class="line number5 index4 alt2"><code class="sql plain">-sql </code><code class="sql string">"SELECT prcnts_id, geog4326.STAsBinary() FROM precincts_reprojected"</code></div><div class="line number6 index5 alt1"><code class="sql plain">-overwrite</code></div></div></pre>
    <p></p>
    <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.<br>
    </p>
    <p><br>
    </p>
    <br>
    <pre class="moz-signature" cols="72">Med venlig hilsen / Best regards

Bo Victor Thomsen

</pre>
    <div class="moz-cite-prefix">Den 20-10-2022 kl. 13:59 skrev Reetz,
      Michael (NLPV) via Qgis-user:<br>
    </div>
    <blockquote type="cite"
      cite="mid:7571805b2ac740628468788e3d9682ad@nlpvw.niedersachsen.de">
      <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-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;}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;}pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;}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;}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]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"
            lang="EN-US">Hi Andrea and Ian,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"
            lang="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.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Thanks
            and best regards<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
style="font-family:"Tahoma",sans-serif;mso-fareast-language:EN-US">Michael<o:p></o:p></span></p>
        <p class="MsoNormal"><span 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
              <a class="moz-txt-link-rfc2396E" 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 class="moz-txt-link-abbreviated" 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<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></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>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"><b><span
                  style="font-size:13.5pt;font-family:"Times New
                  Roman",serif;color:black" lang="EN-US">Reetz,
                  Michael (NLPV)</span></b><span
                style="font-size:13.5pt;font-family:"Times New
                Roman",serif;color:black" lang="EN-US"><br>
              </span><i><span style="color:black" lang="EN-US">Thu Oct
                  20 01:39:42 PDT 2022</span></i><span lang="EN-US">
                <o:p></o:p></span></p>
            <div class="MsoNormal" style="text-align:center"
              align="center">
              <hr style="color:black" width="100%" size="2"
                noshade="noshade" 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 style="color:black" lang="EN-US">So, it looks as if ogr2ogr is not really helpful for me and I have to look for another tool.<o:p></o:p></span></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"
              moz-do-not-send="true"><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"
              moz-do-not-send="true"><span lang="EN-US">https://lists.osgeo.org/mailman/listinfo/gdal-dev</span></a><span
              lang="EN-US"><o:p></o:p></span></p>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
    </blockquote>
  </body>
</html>