How to convert from SQL Server geometry BLOB to something else?

المشرف العام

Administrator
طاقم الإدارة
I have a CSV data file from a 3rd party that is an exported SQL Server table. They simply did a select * from foo and output the result to a text file and sent it over.

In their table is column of Geometry type, so in my raw text I have something like "0xE610000010C47...", etc. At the moment I've loaded it into a table in SQL Server as an nvarchar.

I anticipated I would be able to reverse back into a Geometry field on my end, but that doesn't seem to be so easy. STGeomFromWKB doesn't work because it's not actually a WKB. I can't cast the string as Geometry because it complains that it's not a WKT.

So, is there any way I can get this value into SQL Server as if it is a normal Geometry BLOB? Can I tell SQL Server to treat it as such?

I found this link which helped at least answer my question about what is in SQL Server, but didn't get me all the way there:what is the format of Geometry data type of SQLServer 2008



أكثر...
 
أعلى