Home SQL Server geography result format
Reply: 2

SQL Server geography result format

AAsk
1#
AAsk Published in 2017-12-06 20:35:47Z

Using SQL Server Management Studio:

declare @g geography
set @g = geography::Point(-77.1851436,39.1065236,4326)
select @g

returns

0xE6100000010C14C48A64D94B53C04820B990A28D4340

What format is this result? I know that it is not STAsBinary() - that returns

0x01010000004820B990A28D434014C48A64D94B53C0

Is there a way to create the 0xE61... value using C#?

Evk
2#
Evk Reply to 2017-12-06 21:01:11Z

This is special binary format defined here (you may download PDF there if interested about details of that format). You can create such value in C# like this (reference Microsoft.SqlServer.Types assembly):

var pt = SqlGeography.Point(-77.1851436, 39.1065236, 4326);    
var binary = pt.Serialize().Value;
var hexString = "0x" + BitConverter.ToString(binary).Replace("-", "");
ali zarei
3#
ali zarei Reply to 2017-12-06 21:02:36Z

result is type of Microsoft.SqlServer.Types.SqlGeography.Point

see this link

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.34042 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO