I&#39;ve fixed the field order problem in trunk (<a href="http://trac.osgeo.org/gdal/changeset/20660">http://trac.osgeo.org/gdal/changeset/20660</a>). The corresponding binaries will be available in the next daily build at <a href="http://vbkto.dyndns.org/sdk/">http://vbkto.dyndns.org/sdk/</a>.<br>
<br>Best regards,<br><br>Tamas<br><br><br><div class="gmail_quote">2010/9/21 David Lowther <span dir="ltr">&lt;<a href="mailto:dlowther@coordinatesolutions.com">dlowther@coordinatesolutions.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">










<div link="blue" vlink="blue" lang="EN-US">

<div>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;">Tamas,</span></font></p>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font></p>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;">I altered the table and that did indeed
fix up my ogrinfo results. I&#39;m still not getting anything from Mapserver, but I
am preparing a basic mapfile that should make testing easier.</span></font></p><div class="im">

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font></p>

<div>

<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">David Lowther</span></font><font color="blue"><span style="color: blue;"></span></font></p>

<p class="MsoNormal"><font size="3" color="blue" face="Times New Roman"><span style="font-size: 12pt; color: blue;"> </span></font></p>

<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Coordinate Solutions, Inc.</span></font><font color="blue"><span style="color: blue;"></span></font></p>


<p class="MsoNormal"><font size="3" color="blue" face="Times New Roman"><span style="font-size: 12pt; color: blue;"> </span></font></p>

</div>

</div><div>

<div class="MsoNormal" style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> Tamas Szekeres
[mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>
<b><span style="font-weight: bold;">Sent:</span></b> Monday, September 20, 2010
6:06 PM<div><div></div><div class="h5"><br>
<b><span style="font-weight: bold;">To:</span></b> David Lowther<br>
<b><span style="font-weight: bold;">Cc:</span></b> gdal-dev<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [gdal-dev] OGR MS SQL
Spatial driver has been added</div></div></span></font></p>

</div><div><div></div><div class="h5">

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">David,<br>
<br>
The driver assumes that the first field is the fid and the second is the
geometry column in the table. This doesn&#39;t appear to be a problem until the
table has been created by the same driver.<br>
However in your case the field ordering doesn&#39;t follow this pattern. For a
workaround you may modify your table as follows:<br>
<br>
select [PKey], [Feature], [SpatialDataKey], [StartX], [StartY] into 
MetesAndBoundsHeader2 from MetesAndBoundsHeader<br>
ALTER TABLE dbo.MetesAndBoundsHeader2 ADD CONSTRAINT PK_MetesAndBoundsHeader2
PRIMARY KEY CLUSTERED (PKey)<br>
<br>
and then do the same test with MetesAndBoundsHeader2. (Hopefully this will
solve the mapserver issue as well)<br>
<br>
<br>
I consider this to be a bug in the driver and I&#39;ll correct this issue tomorrow
so as to allow the columns defined in arbitrary field order.<br>
<br>
Best regards,<br>
<br>
Tamas<br>
<br>
<br>
<br>
<br>
</span></font></p>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2010/9/20 David Lowther &lt;<a href="mailto:dlowther@coordinatesolutions.com" target="_blank">dlowther@coordinatesolutions.com</a>&gt;</span></font></p>


<div link="blue" vlink="blue">

<div>

<p class="MsoNormal"><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">CREATE</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <font color="blue"><span style="color: blue;">TABLE</span></font> [dbo]<font color="gray"><span style="color: gray;">.</span></font>[MetesAndBoundsHeader]<font color="gray"><span style="color: gray;">(</span></font></span></font></p>


<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
[PKey] [int] <font color="blue"><span style="color: blue;">IDENTITY</span></font><font color="gray"><span style="color: gray;">(</span></font>1<font color="gray"><span style="color: gray;">,</span></font>1<font color="gray"><span style="color: gray;">)</span></font>
<font color="gray"><span style="color: gray;">NOT</span></font> <font color="gray"><span style="color: gray;">NULL,</span></font></span></font></p>

<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
[SpatialDataKey] [int] <font color="gray"><span style="color: gray;">NULL,</span></font></span></font></p>

<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
[StartX] [decimal]<font color="gray"><span style="color: gray;">(</span></font>18<font color="gray"><span style="color: gray;">,</span></font> 4<font color="gray"><span style="color: gray;">)</span></font> <font color="gray"><span style="color: gray;">NULL,</span></font></span></font></p>


<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
[StartY] [decimal]<font color="gray"><span style="color: gray;">(</span></font>18<font color="gray"><span style="color: gray;">,</span></font> 4<font color="gray"><span style="color: gray;">)</span></font> <font color="gray"><span style="color: gray;">NULL,</span></font></span></font></p>


<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
[Feature] [geometry] <font color="gray"><span style="color: gray;">NULL,</span></font></span></font></p>

<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <font color="blue"><span style="color: blue;">CONSTRAINT</span></font>
[PK_MetesAndBoundsDescription] <font color="blue"><span style="color: blue;">PRIMARY</span></font>
<font color="blue"><span style="color: blue;">KEY</span></font> <font color="blue"><span style="color: blue;">CLUSTERED</span></font> </span></font></p>

<p class="MsoNormal"><font size="2" color="gray" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">(</span></font></p>

<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
[PKey] <font color="blue"><span style="color: blue;">ASC</span></font></span></font></p>

<p class="MsoNormal"><font size="2" color="gray" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">)</span></font><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">WITH </span></font><font size="2" color="gray" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: gray;">(</span></font><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">PAD_INDEX</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">  <font color="gray"><span style="color: gray;">=</span></font> <font color="blue"><span style="color: blue;">OFF</span></font><font color="gray"><span style="color: gray;">,</span></font> <font color="blue"><span style="color: blue;">STATISTICS_NORECOMPUTE</span></font>  <font color="gray"><span style="color: gray;">=</span></font> <font color="blue"><span style="color: blue;">OFF</span></font><font color="gray"><span style="color: gray;">,</span></font> <font color="blue"><span style="color: blue;">IGNORE_DUP_KEY</span></font> <font color="gray"><span style="color: gray;">=</span></font> <font color="blue"><span style="color: blue;">OFF</span></font><font color="gray"><span style="color: gray;">,</span></font> <font color="blue"><span style="color: blue;">ALLOW_ROW_LOCKS</span></font>  <font color="gray"><span style="color: gray;">=</span></font> <font color="blue"><span style="color: blue;">ON</span></font><font color="gray"><span style="color: gray;">,</span></font> <font color="blue"><span style="color: blue;">ALLOW_PAGE_LOCKS</span></font>  <font color="gray"><span style="color: gray;">=</span></font> <font color="blue"><span style="color: blue;">ON</span></font><font color="gray"><span style="color: gray;">)</span></font> <font color="blue"><span style="color: blue;">ON</span></font> [PRIMARY]</span></font></p>


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


<p class="MsoNormal"><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">GO</span></font></p>

<p class="MsoNormal"><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">SET</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <font color="blue"><span style="color: blue;">IDENTITY_INSERT</span></font> [dbo]<font color="gray"><span style="color: gray;">.</span></font>[MetesAndBoundsHeader] <font color="blue"><span style="color: blue;">ON</span></font></span></font></p>


<p class="MsoNormal"><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">INSERT</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> [dbo]<font color="gray"><span style="color: gray;">.</span></font>[MetesAndBoundsHeader]<font color="blue"><span style="color: blue;"> </span></font><font color="gray"><span style="color: gray;">(</span></font>[PKey]<font color="gray"><span style="color: gray;">,</span></font> [SpatialDataKey]<font color="gray"><span style="color: gray;">,</span></font> [StartX]<font color="gray"><span style="color: gray;">,</span></font> [StartY]<font color="gray"><span style="color: gray;">,</span></font> [Feature]<font color="gray"><span style="color: gray;">)</span></font> <font color="blue"><span style="color: blue;">VALUES
</span></font><font color="gray"><span style="color: gray;">(</span></font>8<font color="gray"><span style="color: gray;">,</span></font> 7<font color="gray"><span style="color: gray;">,</span></font> <font color="fuchsia"><span style="color: fuchsia;">CAST</span></font><font color="gray"><span style="color: gray;">(</span></font>463644.9082 <font color="blue"><span style="color: blue;">AS</span></font> <font color="blue"><span style="color: blue;">Decimal</span></font><font color="gray"><span style="color: gray;">(</span></font>18<font color="gray"><span style="color: gray;">,</span></font>
4<font color="gray"><span style="color: gray;">)),</span></font> <font color="fuchsia"><span style="color: fuchsia;">CAST</span></font><font color="gray"><span style="color: gray;">(</span></font>1484517.3764 <font color="blue"><span style="color: blue;">AS</span></font> <font color="blue"><span style="color: blue;">Decimal</span></font><font color="gray"><span style="color: gray;">(</span></font>18<font color="gray"><span style="color: gray;">,</span></font> 4<font color="gray"><span style="color: gray;">)),</span></font>
0xE60E00000104050000009A999999734C1C4100000000E5A636419A999999734C1C4100000000F5CD36419A99999939B01B4100000000A4CE36419A99999939B01B410000000094A736419A999999734C1C4100000000E5A6364101000000020000000001000000FFFFFFFF0000000003<font color="gray"><span style="color: gray;">)</span></font></span></font></p>


<p class="MsoNormal"><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">INSERT</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> [dbo]<font color="gray"><span style="color: gray;">.</span></font>[MetesAndBoundsHeader]<font color="blue"><span style="color: blue;"> </span></font><font color="gray"><span style="color: gray;">(</span></font>[PKey]<font color="gray"><span style="color: gray;">,</span></font> [SpatialDataKey]<font color="gray"><span style="color: gray;">,</span></font> [StartX]<font color="gray"><span style="color: gray;">,</span></font> [StartY]<font color="gray"><span style="color: gray;">,</span></font> [Feature]<font color="gray"><span style="color: gray;">)</span></font> <font color="blue"><span style="color: blue;">VALUES
</span></font><font color="gray"><span style="color: gray;">(</span></font>9<font color="gray"><span style="color: gray;">,</span></font> 8<font color="gray"><span style="color: gray;">,</span></font> <font color="fuchsia"><span style="color: fuchsia;">CAST</span></font><font color="gray"><span style="color: gray;">(</span></font>416571.3699 <font color="blue"><span style="color: blue;">AS</span></font> <font color="blue"><span style="color: blue;">Decimal</span></font><font color="gray"><span style="color: gray;">(</span></font>18<font color="gray"><span style="color: gray;">,</span></font>
4<font color="gray"><span style="color: gray;">)),</span></font> <font color="fuchsia"><span style="color: fuchsia;">CAST</span></font><font color="gray"><span style="color: gray;">(</span></font>1465354.3699 <font color="blue"><span style="color: blue;">AS</span></font> <font color="blue"><span style="color: blue;">Decimal</span></font><font color="gray"><span style="color: gray;">(</span></font>18<font color="gray"><span style="color: gray;">,</span></font> 4<font color="gray"><span style="color: gray;">)),</span></font>
0xE60E00000104050000009A999999ED6C1941000000000A5C36419A999999ED6C1941000000001A8336419A999999B3D0184100000000C98336419A999999B3D0184100000000B95C36419A999999ED6C1941000000000A5C364101000000020000000001000000FFFFFFFF0000000003<font color="gray"><span style="color: gray;">)</span></font></span></font></p>


<p class="MsoNormal"><font size="2" color="blue" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">SET</span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <font color="blue"><span style="color: blue;">IDENTITY_INSERT</span></font> [dbo]<font color="gray"><span style="color: gray;">.</span></font>[MetesAndBoundsHeader] <font color="blue"><span style="color: blue;">OFF</span></font></span></font></p>


<div>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font></p>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font></p>

<div>

<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">David Lowther</span></font></p>

<p class="MsoNormal"><font size="3" color="blue" face="Times New Roman"><span style="font-size: 12pt; color: blue;"> </span></font></p>

<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Coordinate Solutions, Inc.</span></font></p>

<p class="MsoNormal"><font size="3" color="blue" face="Times New Roman"><span style="font-size: 12pt; color: blue;"> </span></font></p>

</div>

</div>

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>

<b><span style="font-weight: bold;">Sent:</span></b> Monday, September 20, 2010 4:56
PM<br>
<b><span style="font-weight: bold;">To:</span></b> David Lowther<br>
<b><span style="font-weight: bold;">Cc:</span></b> gdal-dev<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [gdal-dev] OGR MS SQL
Spatial driver has been added</span></font></p>

</div>

<div>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2010/9/20 David
Lowther &lt;<a href="mailto:dlowther@coordinatesolutions.com" target="_blank">dlowther@coordinatesolutions.com</a>&gt;</span></font></p>

<div link="blue" vlink="blue">

<div>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font> </p>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;">It seems almost as if there is an index off in the field
information.</span></font></p>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font></p>

</div>

</div>

<div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
David,<br>
<br>
That&#39;s strange indeed. What is the database type of this field in the table?
Could you provide your test data to reproduce this? <br>
<br>
 </span></font></p>

</div>

<blockquote style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); border-width: medium medium medium 1pt; margin: 5pt 0in 5pt 4.8pt; padding: 0in 0in 0in 6pt;">


<div link="blue" vlink="blue">

<div>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;">I am also not seeing any features when I render the layer in
Mapserver (though that could be any number of things as I am just getting
started with OGR MSSQL in Mapserver).</span></font></p>

<p class="MsoNormal"><font size="2" color="blue" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: blue;"> </span></font></p>

</div>

</div>

</blockquote>

<div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
It would be helpful to see your mapfile to make sure about the problem.<br>
<br>
<br>
Best regards,<br>
<br>
Tamas</span></font></p>

</div>

</div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

</div>

</div>

</div>

</div>

</div>

<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

</div></div></div>

</div>


</blockquote></div><br>