DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 2216497 - Last Review: April 22, 2011 - Revision: 2.0

On This Page

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  (http://support.microsoft.com/kb/968382/en-US/ ) 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:
2527041  (http://support.microsoft.com/kb/2527041/ ) How 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:
Designing and Implementing Spatial Storage (Database Engine) (http://technet.microsoft.com/en-us/library/bb933790.aspx)

APPLIES TO
  • 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
Keywords: 
kbprb kbsurveynew kbpubtypekc kbcode KB2216497
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support