Trouble seeing “Birth of Venus” image in the SSMS spatial results tab?

Michael J Swart posted a SQL query on his blog that produced a rendition of Botticelli’s Birth of Venus, in the spatial results tab of SQL Server Management Studio when executed. But, when everyone rushed over in anxious anticipation, some folks could execute the query but couldn't see the picture on their 64-bit editions. Here's why…

It's an obscure problem with rendering spatially invalid results that surfaced around SP1 timeframe. The map control that produces the tab cannot execute the MakeValid() method. It's looking for the 32-bit version of SqlServerSpatial.dll that should have been installed in C:\Windows\SysWOW64, as it needs to be on a 64 bit machine. The exception happens inside the Microsoft.SqlServer.Spatial assembly, which cannot locate SqlServerSpatial.dll.

Here's a simple repro:
DECLARE @g GEOMETRY
SELECT @g = GEOMETRY::STGeomFromText('POLYGON((1 1, 3 3, 3 1, 1 3, 1 1))',0)
SELECT @g — Spatial results tab doesn't display in SSMS x64
SELECT @g.MakeValid() — This works
GO

So if this doesn't work for you, you'll need to either,
    A. Locate and install 32-bit SqlServerSpatial.dll in C:\Windows\SysWOW64
or B. Change the script to output the result to a table variable, where you can call MakeValid() on the spatial column.

Reinstalling the spatial library from the SQL Server 2008 Feature Pack may work as well, but I've not tried this so I can't promise.

Then you'll "get the picture".

2 thoughts on “Trouble seeing “Birth of Venus” image in the SSMS spatial results tab?

  1. Thanks for the clarification Bob.
    I had a crack at it, but gave up pretty quickly. Out of curiosity, what resources do you have at your disposal that lets you figure this out?
    (a) You’ve got a plant at Microsoft
    (b) You’ve got Sherlock Holmes-ian sleuthing skillz.
    (c) other (please specify).

  2. Hi Michael,

    I just "walked into it" figuring it might be the control (that runs the spatial results tab) itself. And noticed that validating the geometry fixed it. And went from there…

Comments are closed.

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.