Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:51:43+00:00 2026-06-03T06:51:43+00:00

I have 2 database files in my iOS app: An original database (readonly, kept

  • 0

I have 2 database files in my iOS app:

  • An original database (readonly, kept in my app’s home directory)
  • The user’s database (kept in the user’s Documents folder)

I need to run a SQL query to copy from the original database to the user’s, something like:

INSERT INTO UserDatabase.MyTable
SELECT * FROM OriginalDatabase.MyTable;

Is this possible from SQLite running on iOS? The problem is the two databases are in different folder. I would like to avoid doing this work in code (C#) which is the obvious way to do it, just much slower.

My app is written with C#/MonoTouch, but that is probably irrelevant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:51:44+00:00Added an answer on June 3, 2026 at 6:51 am

    Solved with @Peter M’s link.

    Here is the SQL to do this on iOS:

        ATTACH DATABASE '../YourApp.app/YourDatabase.db' AS OriginalDatabase;
    
        INSERT INTO Main.MyTable
        SELECT * FROM OriginalDatabase.MyTable;
    
        DETACH DATABASE OriginalDatabase;
    

    Note the use of Main, this is the database you are connected to with SqliteConnection, in my case it was located in the Documents folder.

    You can do anything you need against the OriginalDatabase, joins, subselects, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table where the user marks files to be downloaded. Subsequently,
I have a database file .mdf from MS SQL EXPRESS in folder: C:\Program Files\Microsoft
i have csv files, java app and database, i read csv file from my
I have an iPhone (iOS) app that keeps data in a local SQLite database
I am creating ios app in xcode 4.2. I have outside file with database.
I have two config-files /app/config/database.yml and /app/config/userconfig.yml i don't want to put the database
I currently have an iOS app that can 'bootstrap' it's database from a bunch
I have database in the MyApp.app/Contents/Resources folder. I want at least to read data
In my app i have to store Core Data Database and audio files, so
I have a database which contains the link to audio files. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.