Hopefully the question is fairly self-explanatory.
I've been ferreting through the, what appears to be quite minimal/poor microsoft documentation regarding both views and geography datatypes in the sql server 2008, and I think the answer is "no, geography datatypes are either not supported or minimally supported within a view"; but I'm not entirely sure, and I'd love some corroboration.
I've been attempting to add geography data to an existing view. And my end goal is to retrieve longitude/latitude data from the field in question.
Here's the select statement (simplified) that works when applied to the table but doesn't work when defined within the view:
SELECT
[dbo.vendor.location].Lat AS latitude,
FROM
dbo.vendor
Note that [dbo.vendor.location]
is the field, and Lat
is the latitude property of the geography
datatype.
And when that sql is run within the view, the following error is returned:
The multi-part identifier "dbo.vendor.location.Lat" could not be bound
Edit:
Note that I've also tried the following query, with similar results:
SELECT
[dbo].[vendor].[location].Lat AS latitude,
FROM
dbo.vendor
In this case, SQL Management Studio removes the quotes and returns the same "multi-part ... could not be bound" error.
[dbo].[vendor].[location]
) – db2 Dec 24 '13 at 20:20SELECT
statement, excepting theORDER BY
clause. – RBarryYoung Dec 25 '13 at 18:25