[gdal-dev] Another Join issue with OGR/ODBC

Yewondwossen Assefa yassefa at dmsolutions.ca
Mon Oct 19 19:15:26 EDT 2009

Hi all,

I am into some issues when trying to do a  join using a shape file as a 
primary table and an ODBC (sql server 2005) connection as the secondary 
The issue has to do with the schema name.

The following query (with a schema name: imsv7) works as expected:
  - ogrinfo ODBC:sa/ttt at my_db -sql "SELECT * FROM imsv7.COMPSMN WHERE 
This same query without a schema does not work  (which is what  I expected):
    - ogrinfo ODBC:sa/ttt at my_db -sql "SELECT * FROM COMPSMN WHERE 

My issue is that I need to give the schema name when doing a join but 
don't see how I can do that. Here is the  join statement:

  - ogrinfo f:/msapps/ttt/sqlserver/Sewer_Manholes_20090818.shp -sql 
"SELECT *  FROM Sewer_Manholes_20090818 shp LEFT JOIN 
'ODBC:sa/ttt at my_db'.COMPSMN ON shp.COMPKEY = COMPSMN.COMPKEY  where 
COMPKEY = 23533"

The ODBC part of this join ends up being translated into an sql select 
statement without a schema and It fails.
I did not see a way to specify the schema in any part of the join statement.

Is there some thing that I am missing?


best regards,


Assefa Yewondwossen           
Software Analyst   

Email: assefa at dmsolutions.ca    

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925

More information about the gdal-dev mailing list