locked
Sql Geography methods to determine validality of geography data type?????? RRS feed

  • Question

  • Hi,

    I have to programmatically store data via ADO.NET into sql geography data type in DB. As you might know, geography data requires more rigious format of data before saving the data. If the data is incorrect, exception will be thrown from db. One of the methods is STIsValid() method. However, this method cannot validate other cases. For example,

    geography::STGeomFromWKB(geom.MakeValid().Reduce(.00000001).STUnion(geom.STStartPoint()).MakeValid().STAsBinary(), 4326)

     

     

    Is there a method that can tell you whether or not the data is fully acceptable by sql geography data type????????????

     

     

    Thanks

    Thursday, November 25, 2010 10:10 AM

Answers

  • STIsValid() is being introduced for the geography datatype in SQL Server Denali.

    Currently, you can allow for handling invalid data by wrapping the method that creates the SqlGeography instance in a TRY / CATCH construct, and acting accordingly if an exception occurs .


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Pingpong689 Monday, November 29, 2010 9:13 PM
    Thursday, November 25, 2010 10:34 AM
    Answerer