Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm developping an ArcMap Extension and I need to join an existing feature class with data from a sql query located on another DBMS.

I already set up a Workspace with an OleDbWorkspaceFactory. I'm even able to add to the document any table contained in this database. I'm now trying to add a sql query to the document the same way I do it with tables. The query can be complex and include a couple of table with inner/left joins.

I looked in the ESRI documentation and I can't find the good object to do this.

Thanks

share|improve this question
1  
Have you tried the Make Query Table tool? –  Kirk Kuykendall Feb 21 '13 at 19:07
    
I really need to be able to put a full sql statement ("Select ... from ... inner join ... where ..."), like when I define a new query layer in ArcMap –  Goldorak84 Feb 21 '13 at 19:33
    
Are you saying you want to automate the process of doing File>Add Data>Add Query Layer... in arcmap? –  Kirk Kuykendall Feb 21 '13 at 19:46
2  
Did you check to see if ISqlWorkspace.OpenQuery returns a featureclass when the query includes a geometry column? –  Kirk Kuykendall Feb 21 '13 at 20:06
1  
I could always dynamically create the view (with the "CREATE VIEW" sql statement) and do an OpenTable on the view. –  Goldorak84 Feb 21 '13 at 20:39
show 4 more comments

1 Answer 1

up vote 0 down vote accepted

After multiple tests, since my requirement is to use an OleDbWorkspaceFactory, It's impossible to add to the document the results from a query. The only way to add these results it to create a view from the query (CREATE VIEW statement) and then do an OpenTable on the view

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.