Question

I've created an SSIS package that takes geography data out of a SQL Server database and copies it to a geometry column in a Greenplum Postgres database.

I'm doing it in a roundabout way because of weird errors with the PGNP driver when trying it the normal way. So what I'm doing is using GeogColumn.STAsText() on the SQL Server source and inserting that into a text column in the Greenplum database, then running a task that updates the geometry column in the Greenplum table using the newly inserted text, which should e.g. look like POLYGON(-85 42, -86 43).

The problem is that \\000 is getting added after each character and then the update won't work. Here's what it looks like:

Source enter image description here

Destination

enter image description here

How do I stop this from happening?

Was it helpful?

Solution

perhaps try the following(in your TSQL source query):

,CAST(geogColumn.STAsText() as varchar(max)) AS WKT_TEXT 
,geogColumn.STAsBinary() AS WKB_IMAGE 

I would go with the 2nd flavor as it should be slightly more efficient

Not sure what the destination columns need to be on the PG side but i suspect TEXT and IMAGE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top