CREATE OR REPLACE VARIABLE @svg XML;
SELECT ST_Geometry::ST_AsSVGAggr( geometry, 'attribute=fill="black"' )
INTO @svg
FROM Massdata;
The @svg variable now holds an SVG image representing all of the zip code regions in the Massdata table. The 'attribute=fill="black"' specifies the fill color that is used for the generated image. If not specified, the database server chooses a random fill color. Now that you have a variable containing the SVG image you are interested in, you can write it to a file for viewing by other applications. Execute the following statement in Interactive SQL to write the SVG image to a file relative to the database server.
CALL xp_write_file( 'c:\\temp\\Massdata.svg', @svg );
The WRITE_CLIENT_FILE function could also be used to write a file relative to the client application, but additional steps may be required to ensure appropriate privileges are enabled. If you open the SVG image in an application that supports SVG data, you should see an image like the following:
The image is not uniformly black; there are small gaps between the borders of adjacent zip code regions. These are actually white lines between the geometries and is characteristic of the way the SVG is rendered. There are not really any gaps in the data. Larger white lines are rivers and lakes.