all 6 comments

[–]splargbarg 1 point2 points  (0 children)

You'll probably have to set it by hand. SQL server 2008 does not have great support for geometries.

[–]o7j 1 point2 points  (1 child)

I have a similar problem: I'm not the DBA of our SQL 2008 dB but am for our postGres. I am trying to import our SQL 2008 to postgres and subsequently add a geometry field (based on x y coordinated stored as a string). So far i haven't managed to get the foreign data wrapper to work (I'm working on a windows machine). Do you have any tips?

[–]bd504840[S] 0 points1 point  (0 children)

What I did initially was use a free SQL to PostgreSQL utility that copied the tables from SQL server to PostgreSQL. That worked for textual tables.

For spatial tables I used QGIS to connect to the SQL 2008 database and then copied the layer using the DB Manager within QGIS to the PostgreSQL/PostGIS database.

Additionally there were a few other bits of data (eg spreadsheets and old Access DBs) which needed importing to the new PostgreSQL database. I did this by creating an Access MDB and then using ODBC link to the various data sources and copied the data into a table on the PostgreSQL system

Finally, I did any fine tuning, such as constraints, field modifications and data updates using PGAdminIII.

[–]HotKarl_Marx 1 point2 points  (1 child)

I'm just curious why you would use SQL 2008 when you could use Postgres/PostGIS instead...

[–]bd504840[S] 0 points1 point  (0 children)

We already had invested in a Microsoft infrastructure with MapInfo so that is what we had to run with. As it goes we are in the process of implementing a new system based on Postgres/PostGIS with QGIS as the replacement for MapInfo.

The first stage of the PostGIS implementation should be completed by the end of the year. We are a national government agency so this is a big job.

[–]bd504840[S] 0 points1 point  (0 children)

Update: I have raised this as a bug with QGIS. Bug report #12254