H
H
Hope2021-05-04 12:05:26
PostgreSQL
Hope, 2021-05-04 12:05:26

How to solve the problem when migrating geometry from Postgres to sql server?

I have a Postgres database table containing a geometry. I need to transfer this table to sql server. Through a query or csv export / import I export a table from PG to a csv file, the data looks like

"id";"geometry";"geometry_original";"srid_original";"land_id "
2;MULTIPOLYGON ((34.867738797101651 51.865099049629904, 34.86954966691961 51.862413468256364, 34.868444820981885 51.862200710341014, 34.867603401732431 51.862204486724842, 34.866747861394138 51.862391621710451, 34.86596139976286 51.862622074276025, 34.865635968150372 51.86264121685727, 34.865149320831662 51.862528740390104, 34.864739761085545 51.862564155333835, 34.863851753557057 51.862735729559866, 34.863631563686241 51.862754971536, 34.863596867460629 51.862681179554379, 34.863633158613183 51.862596706792, 34.863707168625119 51.862471718538657, 34.863641054472382 51.862286313715927, 34.861175383503792 51.8639528242481, 34.861496102393005 51.864097244929916, 34.862096821003284 51.864286374897809, 34.863418487261733 51.864515973975415, 34.866149312232473 51.864907280288215, 34.867738797101651 51.865099049629904));MULTIPOLYGON ((1207713.62 435719.56, 1207835.84 435419.7, 1207759.53 435396.67, 1207701.57 435397.58, 1207642.81 435418.9, 1207588.85 435445, 1207566.45 435447.32, 1207532.82 435435.09, 1207504.64 435439.27, 1207443.63 435458.88, 1207428.48 435461.15, 1207426.02 435452.96, 1207428.44 435443.54, 1207433.42 435429.59, 1207428.69 435409, 1207260.42 435595.87, 1207282.65 435611.75, 1207324.21 435632.44, 1207415.47 435657.21, 1207603.95 435699.15, 1207713.62 435719.56));634601;354675

and then I do an import from csv into a table of a similar structure on the sklserver - but the fields with the geometry are null.
tell me how to transfer the data correctly (how should they be unloaded from the postgres)? so that they are read and written in sql server.
I searched the internet, but didn't find anything.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2021-05-04
@tsklab

postgres+to+ms+sql+geometry .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question