# sqlite.createDatabase - destroys any existing content

**URL:** <https://forum.xojo.com/t/sqlite-createdatabase-destroys-any-existing-content/80381>\
**Category:** Databases\
**Created:** [May 21, 2024, 3:35pm UTC](https://forum.xojo.com/t/sqlite-createdatabase-destroys-any-existing-content/80381 "2024-05-21T15:35:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Pitchford](https://forum.xojo.com/user_avatar/forum.xojo.com/james_pitchford/32/4568_2.png) [@James\_Pitchford](https://forum.xojo.com/u/James_Pitchford)\
**Post date:** [May 21, 2024, 3:35pm UTC](https://forum.xojo.com/t/sqlite-createdatabase-destroys-any-existing-content/80381/1 "2024-05-21T15:35:46Z")

</div>

I had a bug that took me a while to resolve - so I thought I’d document it.

I had an in-memory database (scanDB) that I wanted saved to a file so that it could be attached to second in-memory database (filterDB). So I used scanDB.createDatabase and then for a long while could not fathom why filterDB could not access tables in the attached scanDB.

Was it a threading problem? Was it a duplicate names issue? Was it not attaching properly? Was something else clearing the database before I was accessing it?

Of course, and it’s obvious in retrospect, I had created the tables and content of scanDB before applying createDatabase - which then created a “New Database”. And perhaps that’s why the name createDatabaseFile was changed - as it does more than create a file for the database.
