Querying Geometry Information

  • I liked this question, I happen to get it right because thinking of .Net is case sensitive and MS typically uses Proper Casing. What wonderous things you can do in SQL Server.

  • Thank you for an interesting question. I have never tried to use the new spatial features, but this has piqued my interest.

    Also interesting nuance about case-sensitive database collation as well as case-sensitive syntax.

  • Very nice, off the beaten path - thanks, Michael!

  • Grr, I hate CS databases.

    Note added to the question

  • L' Eomot Inversé (2/3/2012)


    so what is the correct case mixture? Presumably "geometry" going by Hugo's note, which seems to make SQL Server's type naming a bit inconsistent.

    Yep, "geometry" (all lowercase) is correct.

    I don't know why you think that is inconsistent. ALL data types have their official name in all lowercase:

    SELECT name FROM sys.types WHERE name LIKE '%[A-Z]%' COLLATE Latin1_General_100_BIN2;

    The only inconsistency is that for the true (non-CLR) system types, SQL Server allows mixed case even in case sensitive databases and on case sensitive instances, while it is not as forgiving for the CLR-implemented types (hierarchyid, gemoetry, geography).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • The only one that works is number 3. I left out a comma at first and none of them worked. when I realized it I had already answered none of them.:-(

  • Hugo Kornelis (2/3/2012)


    L' Eomot Inversé (2/3/2012)


    so what is the correct case mixture? Presumably "geometry" going by Hugo's note, which seems to make SQL Server's type naming a bit inconsistent.

    Yep, "geometry" (all lowercase) is correct.

    I don't know why you think that is inconsistent. ALL data types have their official name in all lowercase:[/code]

    The error message

    Could not find method 'STLineFromtext' for type 'Microsoft.SqlServer.Types.SqlGeometry' in assembly 'Microsoft.SqlServer.Types'

    seems to me to suggest that the final componenet of the type's fully qualified name is not "geometry" but "SqlGeometry"; dropping the "Sql" part of teh name is not unreasonable, but that leaves "Geometry" not "geometry". The type has two names (it's name in the collection, and its name in the T-SQL language, and it is not really consistent at all to have capital "G" in one and minisucule "g" in the other.

    Tom

  • I got this one right because I ran into the case sensitivity issue before. I don't use spatial data types often but I like questions and articles related to them. There are definitely some interesting things that you can do with these data types.

  • great question 🙂 thank you

    Alex S
  • Nice - learned something today.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I was fooled by focusing on the 'geometry' type name, rather than on the method name.

    Good question; hats off to Hugo for the excellent follow-up explanation.

    I, too, am not a great fan of CS databases....

    Rob Schripsema
    Propack, Inc.

  • tks for the question

  • Process of elimination based on case sensitivity. It was still a lucky guess. Good question. Thanks for submitting.

    http://brittcluff.blogspot.com/

Viewing 13 posts - 16 through 28 (of 28 total)

You must be logged in to reply to this topic. Login to reply