I'm currently experiencing the strangest behaviour (or at least I find it strange) with geographical queries on SQL Server in Azure. This happens in both SQL Server Management Studio(v18.8) and Visual Studio (2019).
When I run the following code:
DECLARE @latitude VARCHAR(50) = '52.1234567';
DECLARE @longitude VARCHAR(50) = '4.61234567';
SELECT geography::Point(@latitude, @longitude, 4326).Lat
SELECT geography::Point(@latitude, @longitude, 4326).Long
SELECT geography::Point(@latitude, @longitude, 4326).ToString()
I get the following results:
POINT (4.61234567 52.1234567)
As you can see It returns the Latitude and Longitude with a comma instead of a dot.
The ToString() function however does return the Latitude and Longitude as expected.
Does anyone have any idea on how to get the correct behaviour when using .Lat and .Long functions? i.e. getting a string with a dot and not a comma.
When I try to work around it (which I don't prefer) by replacing the ',' by a '.' I do get a string with a dot in stead of a comma but the string gets rounded off, which is undesirable because I need the location to be as accurate as can be.
REPLACE(geography::Point(@latitude, @longitude, 4326).Lat, ',','.');
52.1235 instead of 52.1234567
Thanks in advance.