FilterQuery does not work on "View"

Topics: User Forum
Mar 12, 2007 at 10:33 AM
Hi,

I've created a view in my database so that I can join two tables and generate labels. The problem is that FilterQuery doesn't appear to work on my view.

I set up the view as:

SELECT
dbo.district_and_county_details.Name, dbo.district_and_county_details.URL, dbo.meridian_district_and_county_boundaries.*
FROM
dbo.district_and_county_details
INNER JOIN
dbo.meridian_district_and_county_boundaries
ON
dbo.district_and_county_details.Ons = dbo.meridian_district_and_county_boundaries.ONS

The table "dbo.meridiandistrictandcountyboundaries" contains all of the geometry, and the other table contains meta data for the polygons.

The SQL being used to select from the view (via SharpMap) is:

SELECT
ST.AsBinary(the_geom)
FROM ST.FilterQuery#dbo#combined_district_and_county_view#the_geom(
    ST.MakeEnvelope(
        253379.500433333,
        340147.0002,
        313203.499766667,
        385014.9997,27700
    )
)

And the error being produced is:

Msg 208, Level 16, State 1, Line 1
Invalid object name 'ST.FilterQuery#dbo#combined_district_and_county_view#the_geom'.

Now this is weird, because if I simply select everything from the view and use MsSqlSpatial to do some simple geometry calculations on it (eg. ST.Centroid(the_geom)) it works fine and the data is returned correctly, but the second I try to filter it, it falls over.

Any ideas?

Dylan
Aug 19, 2011 at 3:42 AM

Hi, did you solve it ? Thanks a lot!