1

I would like to merge two similarly constructed spatialite databases. I have tried to open a first database (1), add the second database (2) to the project and copy/paste the attribute table from (2) in the attribute table from (1)...it doesn't work (too simple I guess). Similarly how can I merge two databases with very small differences (one created in QGIS Chugiak, the other in QGIS Nodebo)

  • Can you provide examples of what the small differences are between the two databases? Is it attribute column type or names, geometry mismatches? – SaultDon Oct 18 '16 at 0:44
2

You would do this in DB Manager within QGIS and you would be doing a standard INSERT operation:

insert into spatialitedb_1 (
column1
, column2
, column3
, column4
)

select 
column1
, column2
, column3
, column4
from spatialitedb_2

The above assumes you have matching column names and column orders from both DB's. If not, you can re-arrange and alias non-matching column names like this:

insert into spatialitedb_1 (
    column1
    , column2
    , column3
    , column4
    )

    select 
    column1
    , othername as column2
    , column3
    , anothername as column4
    from spatialitedb_2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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