title: SQL Server geography latitude longitude error
body: <p>I'm using geography data type for calculating shortest distance.  </p>
  
  <pre><code>CREATE TABLE Landmark (
      Id int,   
      Latitude FLOAT,
      Longitude FLOAT
  )
  
  INSERT Landmark VALUES
  (1, 49.242458, -123.153465),
  (2, 49.249381, -122.866683)
  
  WITH GeographyLandmark AS
  (
      SELECT Id, geography::STPointFromText('POINT(' + CAST(Latitude AS VARCHAR(20)) + ' ' + CAST(Longitude AS VARCHAR(20)) + ')', 4326) Location
      FROM Landmark
  )
  
  --this query calculates distance between point and localizations in meters
  SELECT Id, geography::STPointFromText('POINT(' + CAST(49.2424566 AS VARCHAR(20)) + ' ' + CAST(-123.1534623 AS VARCHAR(20)) + ')', 4326).STDistance(Location) Distance
  FROM GeographyLandmark
  </code></pre>
  
  <p>But I am getting this error:</p>
  
  <blockquote>
    <blockquote>
      <p>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.
      System.FormatException: 
         at Microsoft.SqlServer.Types.GeographyValidator.ValidatePoint(Double x, Double y, Nullable<code>1 z, Nullable</code>1 m)
         at Microsoft.SqlServer.Types.Validator.BeginFigure(Double x, Double y, Nullable<code>1 z, Nullable</code>1 m)
         at Microsoft.SqlServer.Types.ForwardingGeoDataSink.BeginFigure(Double x, Double y, Nullable<code>1 z, Nullable</code>1 m)
         at Microsoft.SqlServer.Types.CoordinateReversingGeoDataSink.BeginFigure(Double x, Double y, Nullable<code>1 z, Nullable</code>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)
      .</p>
    </blockquote>
  </blockquote>
  
  <p>What's the problem here?</p>