Reputation: 1429
I'm migrating a table containing geographic information as latitude, longitude, to one using a geography column (in SQL server 2008).
I need to update a stored procedure which returns those values.
I can do this:
DECLARE @geog geography;
SET @geog = (SELECT [geography] FROM MyTable);
SELECT @g.STAsText();
but the signature for the SP, which I don't want to change, requires this:
@latitude [float] OUTPUT,
@longitude [float] OUTPUT
How do I get the right values, as floats?
I can use http://sqltutorials.blogspot.com.au/2007/09/sql-function-split.html or similar, but surely this shouldn't be that convoluted?
Thanks Melanie
Upvotes: 1
Views: 479
Reputation: 556
DECLARE @g geography;
SET @g = (SELECT [geography] FROM MyTable);
SELECT @g.Lat, @g.Long;
Upvotes: 1