Microsoft chose to create its own binary storage format for spatial data and it is not valid for use with any of SQL's OGC WKB functions.

Has anyone run across code to translate from Microsoft's proprietary binary format to OGC's Well Known Binary format?

  • There is a t-sql function .STAsText(), this will output OGC WKT.
    – klewis
    Commented Jan 23, 2017 at 18:18

1 Answer 1


Yes, STAsBinary() will return WKB.


  • Thanks. I had tried that but I used it incorrectly. Thanks for prompting me to pull my head out and look at it from another direction!
    – Chindokae
    Commented Jan 23, 2017 at 20:06
  • @Chindokae, if you think this is the right answer, please accept it so that this thread is marked with a correct answer Commented Jan 26, 2017 at 13:18

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.