[postgis-users] OT: Export/copy postgres geometry to sql server with bcp

Charles Galpin cgalpin at lhsw.com
Tue Jun 28 05:48:40 PDT 2011


Sorry for the somewhat off topic question, but I figured someone here has probably dealt with this.  I am using postgis and am very happy with it, but for various reasons I need to export some of our data to sql server periodically and want to automate it, preferably to fit into our existing framework which uses bcp to import from flat files.  However looking at the binary output of a straight "copy" to CSV the binary formats do not look the same. Is there any way to export to a format that bcp can understand?

I can export the wkt, strip quotes, import into a temp table and then use an insert select to fill the destination table converting the wkt back to a geometry but this is less than ideal.

tia,
charles




More information about the postgis-users mailing list