I have a table containing a LocationEast and LocationNorth columns(int). LocationEast and LocationNorth are coordinates that follows the SWEREF99 standard.

According to this page, http://www.epsg-registry.org/, the SRID for SWEREF99 is 3006.

I then try to run the following code:

INSERT into Places(Name, LocationEast, LocationNorth, GeographicLocation) values ('My Location', 673318, 6580874, geography::STGeomFromText ('POINT(673318 6580874)', 3006))

But I get the following error:

Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography": 
System.FormatException: 24201: Latitude values must be between -90 and 90 degrees.
   at Microsoft.SqlServer.Types.GeographyValidator.ValidatePoint(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.Validator.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.ForwardingGeoDataSink.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.CoordinateReversingGeoDataSink.BeginFigure(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParsePointText(Boolean parseParentheses)
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type)
   at Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeography.ParseText(OpenGisType type, SqlChars taggedText, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
The statement has been terminated.

My question is: How do I use the SWEREF99 format?

  • 3
    You probably are supposed to use the geometry data type, not the geography - geometry::STGeomFromText ('POINT(673318 6580874)', 4977)). Also, you probably want SWEREF99TM? Then it's 3006. Apr 26, 2017 at 14:09
  • 2
    Aah, thank you! It works now! :) Feel free to post it as an answer and I will accept it!
    – JOSEFtw
    Apr 26, 2017 at 14:14

1 Answer 1


To insert a feature, you would need to use geometry spatial type because your coordinates are defined in a projected coordinate system. The Sweref99 coordinate system you refer to is probably is sweref99tm which has epsg code of 3006.

So, it will be:

geometry::STGeomFromText ('POINT(673318 6580874)', 3006))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.