title: Postgis - Migrate table with geometry column to SQL Server
body: <p>I have a table in a PostGIS database with a geometry column, assume the table called roadpublic just has 2 columns as follows:</p>
  
  <p>COLUMN roadid uuid;
  COLUMN geom geometry;</p>
  
  <p>Now, I'd like to import this table into a SQL Server (2012) database using the Postgres Native OLEDB Provider. The provider works like a champ but it recognizes the geometry datatype as a nvarchar(4000) so the data lands in SQL Server with this structure:</p>
  
  <pre><code>roadid  geom
  5730048E-7988-4BF2-B5E4-E7DD2711E042    0105000020E6100000010...deleted...
  BB978741-BE77-456A-82FE-2D55F1417442    0105000020E6100000010...deleted...
  EE404EE4-CA09-4E78-842F-7C27307EAC89    0105000020E6100000010...deleted...
  </code></pre>
  
  <p>The geom column is converted to NVARCHAR(4000).</p>
  
  <p>Ideally, it would be beneficial to export the actual coordinates from PostGIS in text format, then use the SQL Server geometry::STGeomFromText to convert it to a native SQL Server geometry datatype.</p>
  
  <p>Can anyone suggest a strategy for doing this?</p>
  
  <p>Thanks!</p>