<span id="result_box" class="long_text" lang="en"><span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">Hello</span><span title="Cliquer ici pour voir d&#39;autres traductions">,</span><br><br> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">We</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">have encountered a problem</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">on</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">version</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">1.7</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">of</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">QGIS</span> can <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">support</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">the connection</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">to</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">SQL</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">Server</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">2008</span><span title="Cliquer ici pour voir d&#39;autres traductions">.</span><br>
<br> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">When</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">it</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">connects</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">to</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">the</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">base</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">layer</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">does not contain</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">any</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">vector object</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">and</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">the</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">attribute</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">table</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">contains</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">the</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">correct columns</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">and</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">many</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">rows</span><span title="Cliquer ici pour voir d&#39;autres traductions">, but</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">they</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">all contain</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps atn">&quot;</span><span class="" title="Cliquer ici pour voir d&#39;autres traductions">ERROR</span><span title="Cliquer ici pour voir d&#39;autres traductions">&quot;</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">...</span><br>
<br> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">One</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">of</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">you</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">has</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">it</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">managed to</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">run</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">this</span> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">connection</span><span title="Cliquer ici pour voir d&#39;autres traductions">?</span><br>
<br> <span title="Cliquer ici pour voir d&#39;autres traductions" class="hps">Thank you</span><span title="Cliquer ici pour voir d&#39;autres traductions">!<br><br>Christophe Baume<br><br></span></span>

<p class="MsoNormal">Code :</p>

<p class="MsoNormal">the sql table is defined as :
</p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:blue">CREATE</span><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"> <span style="color:blue">TABLE</span> [dbo]<span style="color:gray">.</span>[T_CommuneGeographie]<span style="color:gray">(</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">      </span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:
EN-US" lang="EN-US">[COMGEO_Id] [uniqueidentifier] <span style="color:blue">ROWGUIDCOL</span> 
<span style="color:gray">NOT</span> <span style="color:gray">NULL,</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US">     
[COMGEO_Commune_COM_Id] [uniqueidentifier] <span style="color:gray">NOT</span> <span style="color:gray">NULL,</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US">     
[COMGEO_Geographie] [geography] <span style="color:gray">NOT</span> <span style="color:gray">NULL,</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US">     
[COMGEO_DateDebut] [date] <span style="color:gray">NULL,</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US">     
[COMGEO_DateFin] [date] <span style="color:gray">NULL,</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-ansi-language:
EN-US" lang="EN-US">CONSTRAINT</span><span style="font-size:10.0pt;font-family:
&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US"> [PK_T_CommuneGeographie] <span style="color:blue">PRIMARY</span> <span style="color:blue">KEY</span> <span style="color:blue">CLUSTERED</span> </span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:gray;mso-ansi-language:
EN-US" lang="EN-US">(</span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US">     
[COMGEO_Id] <span style="color:blue">ASC</span></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:gray;mso-ansi-language:
EN-US" lang="EN-US">)</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:blue;mso-ansi-language:EN-US" lang="EN-US">WITH </span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:gray;mso-ansi-language:
EN-US" lang="EN-US">(</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:blue;mso-ansi-language:EN-US" lang="EN-US">PAD_INDEX</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-ansi-language:EN-US" lang="EN-US"> 
<span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> <span style="color:blue">STATISTICS_NORECOMPUTE</span> 
<span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> <span style="color:blue">IGNORE_DUP_KEY</span> <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> <span style="color:blue">ALLOW_ROW_LOCKS</span> 
<span style="color:gray">=</span> <span style="color:blue">ON</span><span style="color:gray">,</span> <span style="color:blue">ALLOW_PAGE_LOCKS</span> 
<span style="color:gray">=</span> <span style="color:blue">ON</span><span style="color:gray">)</span> <span style="color:blue">ON</span> [PRIMARY]</span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:gray">)</span><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"> <span style="color:blue">ON</span> [PRIMARY]</span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"> </span></p>

<p class="MsoNormal">the lines entered into the python console:
</p>

<p class="MsoNormal">conn_string =
&quot;MSSQL:server=.\SQLExpress;database=ObservatoireCommerce;trusted_connection=yes;tables=dbo.T_CommuneGeographie(COMGEO_Geographie)&quot;</p>

<p class="MsoNormal"><span style="mso-ansi-language:EN-US" lang="EN-US">qgis.utils.iface.addVectorLayer(conn_string,&#39;test&#39;,&#39;ogr&#39;)</span></p>

<br>