Pregunta

I trying to insert some coordinates into my database yet every time I do so it just says <Binary data> in the value.

I tried

geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326)
geography::STPointFromText('POINT(55.9523783996701 -3.2051030639559)', 4326)
geography::Point(51.4618933852762, -0.926690306514502, 4326)

Is it normal for it just to say <Binary data>?

¿Fue útil?

Solución

Yes, internally UDTs (User Defined Types), which is how geography is implemented, get stored as binary, however, they are recognized by the database engine as being more than that.

SQL Server automatically deserializes the binary back into a .NET object when you access it, and also serializes the .NET object to binary for storage.

So, when you call methods on UDT instances, whether in a variable or a column, they respond as you would expect:

declare @var geography = 
       geography::Point(51.4618933852762, -0.926690306514502, 4326);

select @var.ToString()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top