You are currently offline, waiting for your internet to reconnect

FIX: Spatial Storage geometry polygon data types with internal rings return incorrect data through different geometric operations

SYMPTOMS
In Microsoft SQL Server 2008 or Microsoft SQL Server 2008 R2, when you try to perform a geometry operation on a polygon that has an interior ring, the operation returns an unexpected result.

For example, you run the following script:
declare @g1 geometry = 'GEOMETRYCOLLECTION(POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 8 2, 8 8, 2 8, 2 2)))'declare @g2 geometry = 'GEOMETRYCOLLECTION(POLYGON ((2 2, 8 2, 8 8, 2 8, 2 2)))'select @g1.STIntersection(@g2).ToString() 
When you run this script, the STIntersection method does not return the following value:
LINESTRING (2 2, 8 2, 8 8, 2 8, 2 2)
Instead, the method returns the following incorrect value:
POLYGON ((2 2, 8 2, 8 8, 2 8, 2 2))
CAUSE
This problem occurs because SQL Server 2008 or SQL Server 2008 R2 does not recognize the second ring of the Polygon in the first GeometryCollection. This problem occurs only when certain instances of SqlGeometry of type GeometryCollections that have certain ring orientations are used. The problem does not occur when the SqlGeography data type is used.
RESOLUTION

Service pack information for SQL Server 2008

To resolve this problem, obtain the latest service pack for SQL Server 2008. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
968382 How to obtain the latest service pack for SQL Server 2008

Service pack information for SQL Server 2008 R2

To resolve this problem, obtain the latest service pack for SQL Server 2008 R2. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2527041How to obtain the latest service pack for SQL Server 2008 R2
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

This problem was first corrected in SQL Server 2008 Service Pack 2 for SQL Server 2008.
This problem was first corrected in SQL Server 2008 R2 Service Pack 1 for SQL Server 2008 R2.
REFERENCES
For more information about how to work with geometry data types, visit the following Microsoft TechNet webpage:
SQL2008 Spatial Storage Geometry polygons KatmaiPCU2
Properties

Article ID: 2216497 - Last Review: 04/22/2011 17:40:00 - Revision: 2.0

  • Microsoft SQL Server 2008 Enterprise
  • Microsoft SQL Server 2008 Developer
  • Microsoft SQL Server 2008 Standard
  • Microsoft SQL Server 2008 R2 Developer
  • Microsoft SQL Server 2008 R2 Enterprise
  • Microsoft SQL Server 2008 R2 Standard
  • kbprb kbsurveynew kbpubtypekc kbcode KB2216497
Feedback