{"id":23,"date":"2014-08-06T16:10:29","date_gmt":"2014-08-06T16:10:29","guid":{"rendered":"http:\/\/www.sqlgeometry.com\/?p=23"},"modified":"2014-08-08T00:14:34","modified_gmt":"2014-08-08T00:14:34","slug":"moving-geom-accross-linked-servers-with-mssql","status":"publish","type":"post","link":"https:\/\/www.sqlgeometry.com\/?p=23","title":{"rendered":"Moving geometry accross linked servers with MSSQL"},"content":{"rendered":"<p>MSSQL implements geometry via the Common Language Runtime (<a title=\"CLR\" href=\"http:\/\/en.wikipedia.org\/wiki\/Common_Language_Runtime\">CLR<\/a>). This implementation doesn&#8217;t allow you to call these function across linked servers. The solution is to create a view and\u00a0 convert the geometry into x,y values (or lat\/long for geography).<\/p>\n<p>Then convert your data back into geometry when exposing the data in a view on the destination.<\/p>\n<p>&nbsp;<\/p>\n<p>Example:<br \/>\n<code><br \/>\nSELECT x<br \/>\n,y<br \/>\n,GEOMETRY::STPointFromText<br \/>\n('POINT(' + CONVERT(VARCHAR(30), x)<br \/>\n+ ' ' + CONVERT(VARCHAR(30), y)<br \/>\n+ ')', 2927) AS shapegeometry<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MSSQL implements geometry via the Common Language Runtime (CLR). This implementation doesn&#8217;t allow you to call these function across linked servers. The solution is to create a view and\u00a0 convert the geometry into x,y values (or lat\/long for geography). Then convert your data back into geometry when exposing the data in a view on the &hellip; <a href=\"https:\/\/www.sqlgeometry.com\/?p=23\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Moving geometry accross linked servers with MSSQL<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":4,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlgeometry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}